]> git.kaiwu.me - njs.git/commitdiff
Types: fixed Fetch API types.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 10 Feb 2023 02:34:51 +0000 (18:34 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 10 Feb 2023 02:34:51 +0000 (18:34 -0800)
test/ts/test.ts
ts/ngx_core.d.ts

index cc3392935f27e2b4c152128d12587b0a0d1a993b..ddbb495efa44eb0acac257976036551501c00672 100644 (file)
@@ -91,6 +91,9 @@ async function http_module(r: NginxHTTPRequest) {
             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))
index 042e6f253218f40b8d1dafd5cf0bfbca16d69dda..cb5e47f5ec274f0d5ab89e7a9f0c017904548412 100644 (file)
@@ -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 {