[njs] HTTP: fixed TypeScript description for headers.

Dmitry Volyntsev xeioex at nginx.com
Mon Jul 6 18:39:36 UTC 2020


details:   https://hg.nginx.org/njs/rev/5c84e6e56386
branches:  
changeset: 1451:5c84e6e56386
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Jul 06 16:44:03 2020 +0000
description:
HTTP: fixed TypeScript description for headers.

The common headers were declared using only lowercase characters.
Unknown outgoing headers are declared as having the following type:
NjsStringLike | NjsStringLike[]. This causes an issue when unknown
header is used in the context requiring only NjsStringLike.

The fix is to declare common headers using canonical casing.

The issue was introduced in 8f3ef384f69e.

diffstat:

 nginx/ts/ngx_http_js_module.d.ts |  124 +++++++++++++++++++-------------------
 1 files changed, 62 insertions(+), 62 deletions(-)

diffs (141 lines):

diff -r 2c3c34706ce2 -r 5c84e6e56386 nginx/ts/ngx_http_js_module.d.ts
--- a/nginx/ts/ngx_http_js_module.d.ts	Sat Jun 27 19:26:41 2020 +0300
+++ b/nginx/ts/ngx_http_js_module.d.ts	Mon Jul 06 16:44:03 2020 +0000
@@ -6,75 +6,75 @@ interface NginxHTTPArgs {
 
 interface NginxHeadersIn {
     // common request headers
-    readonly 'accept'?: NjsByteString;
-    readonly 'accept-charset'?: NjsByteString;
-    readonly 'accept-encoding'?: NjsByteString;
-    readonly 'accept-language'?: NjsByteString;
-    readonly 'authorization'?: NjsByteString;
-    readonly 'cache-control'?: NjsByteString;
-    readonly 'connection'?: NjsByteString;
-    readonly 'content-length'?: NjsByteString;
-    readonly 'content-type'?: NjsByteString;
-    readonly 'cookie'?: NjsByteString;
-    readonly 'date'?: NjsByteString;
-    readonly 'expect'?: NjsByteString;
-    readonly 'forwarded'?: NjsByteString;
-    readonly 'from'?: NjsByteString;
-    readonly 'host'?: NjsByteString;
-    readonly 'if-match'?: NjsByteString;
-    readonly 'if-modified-since'?: NjsByteString;
-    readonly 'if-none-match'?: NjsByteString;
-    readonly 'if-range'?: NjsByteString;
-    readonly 'if-unmodified-since'?: NjsByteString;
-    readonly 'max-forwards'?: NjsByteString;
-    readonly 'origin'?: NjsByteString;
-    readonly 'pragma'?: NjsByteString;
-    readonly 'proxy-authorization'?: NjsByteString;
-    readonly 'range'?: NjsByteString;
-    readonly 'referer'?: NjsByteString;
-    readonly 'te'?: NjsByteString;
-    readonly 'user-agent'?: NjsByteString;
-    readonly 'upgrade'?: NjsByteString;
-    readonly 'via'?: NjsByteString;
-    readonly 'warning'?: NjsByteString;
-    readonly 'x-forwarded-for'?: NjsByteString;
+    readonly 'Accept'?: NjsByteString;
+    readonly 'Accept-Charset'?: NjsByteString;
+    readonly 'Accept-Encoding'?: NjsByteString;
+    readonly 'Accept-Language'?: NjsByteString;
+    readonly 'Authorization'?: NjsByteString;
+    readonly 'Cache-Control'?: NjsByteString;
+    readonly 'Connection'?: NjsByteString;
+    readonly 'Content-Length'?: NjsByteString;
+    readonly 'Content-Type'?: NjsByteString;
+    readonly 'Cookie'?: NjsByteString;
+    readonly 'Date'?: NjsByteString;
+    readonly 'Expect'?: NjsByteString;
+    readonly 'Forwarded'?: NjsByteString;
+    readonly 'From'?: NjsByteString;
+    readonly 'Host'?: NjsByteString;
+    readonly 'If-Match'?: NjsByteString;
+    readonly 'If-Modified-Since'?: NjsByteString;
+    readonly 'If-None-Match'?: NjsByteString;
+    readonly 'If-Range'?: NjsByteString;
+    readonly 'If-Unmodified-Since'?: NjsByteString;
+    readonly 'Max-Forwards'?: NjsByteString;
+    readonly 'Origin'?: NjsByteString;
+    readonly 'Pragma'?: NjsByteString;
+    readonly 'Proxy-Authorization'?: NjsByteString;
+    readonly 'Range'?: NjsByteString;
+    readonly 'Referer'?: NjsByteString;
+    readonly 'TE'?: NjsByteString;
+    readonly 'User-Agent'?: NjsByteString;
+    readonly 'Upgrade'?: NjsByteString;
+    readonly 'Via'?: NjsByteString;
+    readonly 'Warning'?: NjsByteString;
+    readonly 'X-Forwarded-For'?: NjsByteString;
 
     readonly [prop: string]: NjsByteString;
 }
 
 interface NginxHeadersOut {
     // common response headers
-    'age'?: NjsStringLike;
-    'allow'?: NjsStringLike;
-    'alt-svc'?: NjsStringLike;
-    'cache-control'?: NjsStringLike;
-    'connection'?: NjsStringLike;
-    'content-disposition'?: NjsStringLike;
-    'content-encoding'?: NjsStringLike;
-    'content-language'?: NjsStringLike;
-    'content-length'?: NjsStringLike;
-    'content-location'?: NjsStringLike;
-    'content-range'?: NjsStringLike;
-    'content-type'?: NjsStringLike;
-    'date'?: NjsStringLike;
-    'etag'?: NjsStringLike;
-    'expires'?: NjsStringLike;
-    'last-modified'?: NjsStringLike;
-    'link'?: NjsStringLike;
-    'location'?: NjsStringLike;
-    'pragma'?: NjsStringLike;
-    'proxy-authenticate'?: NjsStringLike;
-    'retry-after'?: NjsStringLike;
-    'server'?: NjsStringLike;
-    'trailer'?: NjsStringLike;
-    'transfer-encoding'?: NjsStringLike;
-    'upgrade'?: NjsStringLike;
-    'vary'?: NjsStringLike;
-    'via'?: NjsStringLike;
-    'warning'?: NjsStringLike;
-    'www-authenticate'?: NjsStringLike;
+    'Age'?: NjsStringLike;
+    'Allow'?: NjsStringLike;
+    'Alt-Svc'?: NjsStringLike;
+    'Cache-Control'?: NjsStringLike;
+    'Connection'?: NjsStringLike;
+    'Content-Disposition'?: NjsStringLike;
+    'Content-Encoding'?: NjsStringLike;
+    'Content-Language'?: NjsStringLike;
+    'Content-Length'?: NjsStringLike;
+    'Content-Location'?: NjsStringLike;
+    'Content-Range'?: NjsStringLike;
+    'Content-Type'?: NjsStringLike;
+    'Date'?: NjsStringLike;
+    'ETag'?: NjsStringLike;
+    'Expires'?: NjsStringLike;
+    'Last-Modified'?: NjsStringLike;
+    'Link'?: NjsStringLike;
+    'Location'?: NjsStringLike;
+    'Pragma'?: NjsStringLike;
+    'Proxy-Authenticate'?: NjsStringLike;
+    'Retry-After'?: NjsStringLike;
+    'Server'?: NjsStringLike;
+    'Trailer'?: NjsStringLike;
+    'Transfer-Encoding'?: NjsStringLike;
+    'Upgrade'?: NjsStringLike;
+    'Vary'?: NjsStringLike;
+    'Via'?: NjsStringLike;
+    'Warning'?: NjsStringLike;
+    'WWW-Authenticate'?: NjsStringLike;
 
-    'set-cookie'?: NjsStringLike[];
+    'Set-Cookie'?: NjsStringLike[];
 
     [prop: string]: NjsStringLike | NjsStringLike[];
 }


More information about the nginx-devel mailing list