Dmitry Volyntsev
November 15, 2023 07:26PM
details: https://hg.nginx.org/njs/rev/0213cb43bfce
branches:
changeset: 2233:0213cb43bfce
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Wed Nov 15 15:07:20 2023 -0800
description:
Fetch: fixed Headers.set().

This closes #680 issue on Github.

diffstat:

nginx/ngx_js_fetch.c | 10 ++++++++++
nginx/t/js_fetch_objects.t | 5 +++++
2 files changed, 15 insertions(+), 0 deletions(-)

diffs (38 lines):

diff -r f936754f6f62 -r 0213cb43bfce nginx/ngx_js_fetch.c
--- a/nginx/ngx_js_fetch.c Thu Nov 09 17:09:16 2023 -0800
+++ b/nginx/ngx_js_fetch.c Wed Nov 15 15:07:20 2023 -0800
@@ -3637,9 +3637,19 @@ ngx_headers_js_ext_set(njs_vm_t *vm, njs
ph = &(*ph)->next;
*pp = NULL;
}
+
+ goto done;
}
}

+ ret = ngx_js_headers_append(vm, headers, name.start, name.length,
+ value.start, value.length);
+ if (ret != NJS_OK) {
+ return NJS_ERROR;
+ }
+
+done:
+
njs_value_undefined_set(retval);

return NJS_OK;
diff -r f936754f6f62 -r 0213cb43bfce nginx/t/js_fetch_objects.t
--- a/nginx/t/js_fetch_objects.t Thu Nov 09 17:09:16 2023 -0800
+++ b/nginx/t/js_fetch_objects.t Wed Nov 15 15:07:20 2023 -0800
@@ -206,6 +206,11 @@ my $p0 = port(8080);
h.set('a', '#');
return h.get('a');
}, '#'],
+ ['set on empty', () => {
+ var h = new Headers([]);
+ h.set('x-test', '1234');
+ return h.get('x-test');
+ }, '1234'],
];

run(r, tests);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fetch: fixed Headers.set().

Dmitry Volyntsev 329 November 15, 2023 07:26PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 184
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready