[njs] Types: fixed Fetch API types.

Dmitry Volyntsev xeioex at nginx.com
Fri Feb 10 05:07:29 UTC 2023


details:   https://hg.nginx.org/njs/rev/12a6d0517ae8
branches:  
changeset: 2045:12a6d0517ae8
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Feb 09 18:34:51 2023 -0800
description:
Types: fixed Fetch API types.

diffstat:

 test/ts/test.ts  |  3 +++
 ts/ngx_core.d.ts |  4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 4da29a050b6e -r 12a6d0517ae8 test/ts/test.ts
--- a/test/ts/test.ts	Thu Feb 09 18:34:46 2023 -0800
+++ b/test/ts/test.ts	Thu Feb 09 18:34:51 2023 -0800
@@ -91,6 +91,9 @@ async function http_module(r: NginxHTTPR
             throw 'oops'
         };
 
+        let out: Array<string> = reply.headers.getAll("foo");
+        let has: boolean = reply.headers.has("foo");
+
         return reply.text()
     })
     .then(body => r.return(200, body))
diff -r 4da29a050b6e -r 12a6d0517ae8 ts/ngx_core.d.ts
--- a/ts/ngx_core.d.ts	Thu Feb 09 18:34:46 2023 -0800
+++ b/ts/ngx_core.d.ts	Thu Feb 09 18:34:51 2023 -0800
@@ -10,13 +10,13 @@ interface NgxResponseHeaders {
      * with the specified name.
      * @param name A name of the header.
      */
-    getAll(name:NjsStringLike): NjsByteString;
+    getAll(name:NjsStringLike): Array<NjsByteString>;
     /**
      * Returns a boolean value indicating whether a header with
      * the specified name exists.
      * @param name A name of the header.
      */
-    has(name:NjsStringLike): NjsByteString;
+    has(name:NjsStringLike): boolean;
 }
 
 interface NgxResponse {


More information about the nginx-devel mailing list