Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning a request with an additional property throws an unrelated error in 1.9.2 – 1.10.2 #10355

Closed
johnspurlock opened this issue Apr 24, 2021 · 2 comments · Fixed by #10769
Labels
bug Something isn't working correctly ext/fetch related to the ext/fetch

Comments

@johnspurlock
Copy link
Contributor

Note this only happens when the source request is in the RequestInit position (see below).

I found #10286, but this situation really has nothing to do with request.cache, the clone should succeed, and later throw if and only if cache is accessed.

This did not throw in 1.9.0.

deno 1.9.2 (release, x86_64-apple-darwin)
v8 9.1.269.5
typescript 4.2.2
// tmp.ts
const port = parseInt(Deno.args[0]);
const listener = Deno.listen({ port: port });

fetch(`http://localhost:${port}`).then(r => console.log(r)).catch(e => console.error(e));

for await (const conn of listener) {
    (async () => {
        for await (const { request, respondWith } of Deno.serveHttp(conn)) {
            (request as any).foo = true;
            // const reqCopy = new Request(request); // this succeeds
            const reqCopy = new Request(request.url, request); // this throws
            respondWith(new Response(`${reqCopy.url}`));
        }
    })();
}

deno run --unstable --allow-net tmp.ts 3333

error: Uncaught (in promise) TypeError: This property is not implemented.
            const reqCopy = new Request(request.url, request); // this throws
                            ^
    at Request.get cache (deno:op_crates/fetch/23_request.js:343:13)
    at Array.RequestInit (deno:op_crates/webidl/00_webidl.js:661:33)
    at new Request (deno:op_crates/fetch/23_request.js:198:46)
    at tmp.ts:11:29
@kitsonk kitsonk added bug Something isn't working correctly ext/fetch related to the ext/fetch labels Apr 24, 2021
@johnspurlock
Copy link
Contributor Author

Still broken in 1.10.2 - different line in 23_request.js, but same basic issue.

deno 1.10.2 (release, x86_64-apple-darwin)
v8 9.1.269.27
typescript 4.2.2
error: Uncaught (in promise) TypeError: This property is not implemented.
            const reqCopy = new Request(request.url, request); // this throws
                            ^
    at Request.get cache (deno:extensions/fetch/23_request.js:346:13)
    at Array.RequestInit (deno:extensions/webidl/00_webidl.js:661:33)
    at new Request (deno:extensions/fetch/23_request.js:198:46)
    at tmp.ts:12:29

@johnspurlock johnspurlock changed the title Cloning a request with an additional property throws an unrelated error in 1.9.2 Cloning a request with an additional property throws an unrelated error in 1.9.2 – 1.10.2 May 19, 2021
@kitsonk
Copy link
Contributor

kitsonk commented May 19, 2021

There is a reason why the issue is still open, because it isn't fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly ext/fetch related to the ext/fetch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants