From 3cb260ed15a26785272bb09427504a565010963d Mon Sep 17 00:00:00 2001 From: Felipe Baltor Date: Sun, 30 Jul 2023 10:13:28 -0300 Subject: fix(Deno.serve): accessing .url on cloned request throws (#19869) This PR fixes #19818. The problem was that the new InnerRequest class does not initialize the fields urlList and urlListProcessed that are used during a request clone. The solution aims to be straightforward by simply initializing the missing properties during the clone process. I also implemented a "cache" to the url getter of the new InnerRequest, avoiding the cost of calling op_http_get_request_method_and_url. --- ext/fetch/23_request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/fetch/23_request.js') diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js index daf77a834..afd3c1c50 100644 --- a/ext/fetch/23_request.js +++ b/ext/fetch/23_request.js @@ -174,8 +174,8 @@ function cloneInnerRequest(request, skipBody = false) { body, redirectMode: request.redirectMode, redirectCount: request.redirectCount, - urlList: request.urlList, - urlListProcessed: request.urlListProcessed, + urlList: [() => request.url()], + urlListProcessed: [request.url()], clientRid: request.clientRid, blobUrlEntry: request.blobUrlEntry, url() { -- cgit v1.2.3