Deno: [not implemented]: POST tar file with Deno

Created on 15 May 2020  路  5Comments  路  Source: denoland/deno

using fetch() to POST tar file implementation:

    const ab = new ArrayBuffer(1024 * 1024);
    const buf = new Buffer(ab);
    const mw = new MultipartWriter(buf);
    const f = await open(path.resolve('test.tar'), {
        read: true,
    });
    await mw.writeFile('myTestField', 'test.tar', f);
    const contentType = mw.formDataContentType();
    await mw.close();
    f.close();

    const response1 = await fetch('http://localhost:8080/test', {
        headers: [
            ['Content-Type', contentType]
        ],
        method: 'POST',
        body: ab,
    });

    if (response != undefined) {
        await response.arrayBuffer();
        assertEquals(200, response.status);
    }

fails with ReadableStream:

Error: not implemented
    at Object.notImplemented ($deno$/util.ts:64:9)
    at fetch ($deno$/web/fetch.ts:572:11)

Is there an alternative way to have it done in Deno?

bug web

All 5 comments

@marcosc90 I think you had a similar PR but cannot find it

Thanks @marcosc90. This issue is still valid as ReadableStream variant is not implemented.

Supporting ReadableStreams is fairly easy on TS side. I don't know rust yet to modify op_fetch so we get a resource we can write to.

related to https://github.com/denoland/deno/pull/6093

@marcosc90 thank you for looking into this issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JosephAkayesi picture JosephAkayesi  路  3Comments

sh7dm picture sh7dm  路  3Comments

ry picture ry  路  3Comments

doutchnugget picture doutchnugget  路  3Comments

benjamingr picture benjamingr  路  3Comments