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

Clone request method issues #30

Open
oxcafedead opened this issue Apr 12, 2023 · 0 comments
Open

Clone request method issues #30

oxcafedead opened this issue Apr 12, 2023 · 0 comments

Comments

@oxcafedead
Copy link

Hi @RichiCoder1!

I am looking at the function cloneRequest:

return new Request(url.toString(), new Request(request, {}));

Because of strange implementation of URL class inside workers runtime, non-encoded parameters get encoded after toString invocation. It's not reproduced in Chrome/Firefox/node.js though.

I shall probably report an issue with it for Cloudflared - but can we review this function overall from the usage perspective as well?
Is there some reason to do URL construction on request clone? Can we have smth like:

downstreamRequest = new Request(request);

or

function cloneRequest(request) {
  return new Request(request.url, request);
}

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant