mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-12 22:10:01 -04:00
return the correct headers object
This commit is contained in:
parent
563a2b7310
commit
0b14c32b25
4 changed files with 16 additions and 2 deletions
|
@ -4,6 +4,6 @@ err\("__syscall_getsockname " ?\+ ?fd\);
|
|||
|
||||
|
||||
/* INSERT
|
||||
function _emscripten_console_error\(str\) {
|
||||
function _emscripten_console_error\(str\) ?{
|
||||
*/
|
||||
if (UTF8ToString(str).endsWith("__syscall_setsockopt\\n")) return;
|
|
@ -122,6 +122,7 @@ function create_response(response_data, response_info) {
|
|||
response_info.ok = response_info.status >= 200 && response_info.status < 300;
|
||||
response_info.statusText = status_messages[response_info.status] || "";
|
||||
|
||||
//construct base response object
|
||||
let response_obj = new Response(response_data, response_info);
|
||||
for (let key in response_info) {
|
||||
if (key == "headers") continue;
|
||||
|
@ -130,6 +131,13 @@ function create_response(response_data, response_info) {
|
|||
value: response_info[key]
|
||||
});
|
||||
}
|
||||
|
||||
//create headers object
|
||||
Object.defineProperty(response_obj, "headers", {
|
||||
writable: false,
|
||||
value: new Headers(response_info.headers)
|
||||
});
|
||||
|
||||
return response_obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ for fragment_file in fragments_path.iterdir():
|
|||
matches = re.findall(match_regex, fragment_text, re.S)
|
||||
|
||||
for mode, patch_regex, patch_text, _ in matches:
|
||||
fragment_matches = re.findall(patch_regex, target_text)
|
||||
if not fragment_matches:
|
||||
print(f"warning: regex did not match anything - '{patch_regex}'");
|
||||
if mode == "DELETE":
|
||||
target_text = re.sub(patch_regex, "", target_text)
|
||||
elif mode == "REPLACE":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue