[njs] Types: added forgotten r.rawHeadersIn and r.rawHeadersOut description.
Dmitry Volyntsev
xeioex at nginx.com
Fri Feb 10 05:07:31 UTC 2023
details: https://hg.nginx.org/njs/rev/8b0350c4b19e
branches:
changeset: 2046:8b0350c4b19e
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Thu Feb 09 18:34:51 2023 -0800
description:
Types: added forgotten r.rawHeadersIn and r.rawHeadersOut description.
diffstat:
test/ts/test.ts | 2 ++
ts/ngx_http_js_module.d.ts | 11 +++++++++++
ts/njs_core.d.ts | 6 ++++++
3 files changed, 19 insertions(+), 0 deletions(-)
diffs (48 lines):
diff -r 12a6d0517ae8 -r 8b0350c4b19e test/ts/test.ts
--- a/test/ts/test.ts Thu Feb 09 18:34:51 2023 -0800
+++ b/test/ts/test.ts Thu Feb 09 18:34:51 2023 -0800
@@ -45,6 +45,8 @@ async function http_module(r: NginxHTTPR
r.headersOut['Set-Cookie'] = ['aaa', 'bbb'];
r.headersOut['Foo'] = ['aaa', 'bbb'];
+ let values: Array<string> = r.rawHeadersIn.filter(v=>v[0].toLowerCase() == 'foo').map(v=>v[1]);
+
// r.log
r.log(bs);
diff -r 12a6d0517ae8 -r 8b0350c4b19e ts/ngx_http_js_module.d.ts
--- a/ts/ngx_http_js_module.d.ts Thu Feb 09 18:34:51 2023 -0800
+++ b/ts/ngx_http_js_module.d.ts Thu Feb 09 18:34:51 2023 -0800
@@ -339,6 +339,17 @@ interface NginxHTTPRequest {
*/
readonly parent?: NginxHTTPRequest;
/**
+ * An array of key-value pairs exactly as they were received from the client.
+ * @since 0.4.1
+ */
+ readonly rawHeadersIn: [NjsFixedSizeArray<2, NjsStringLike>];
+ /**
+ * An array of key-value pairs of response headers.
+ * Header field names are not converted to lower case, duplicate field values are not merged.
+ * @since 0.4.1
+ */
+ readonly rawHeadersOut: [NjsFixedSizeArray<2, NjsStringLike>];
+ /**
* Client address.
*/
readonly remoteAddress: NjsByteString;
diff -r 12a6d0517ae8 -r 8b0350c4b19e ts/njs_core.d.ts
--- a/ts/njs_core.d.ts Thu Feb 09 18:34:51 2023 -0800
+++ b/ts/njs_core.d.ts Thu Feb 09 18:34:51 2023 -0800
@@ -1,5 +1,11 @@
type BufferEncoding = "utf8" | "hex" | "base64" | "base64url";
+type NjsFixedSizeArray<N extends number, T> = N extends 0 ? never[] : {
+ 0: T;
+ length: N;
+} & ReadonlyArray<T>;
+
+
interface StringConstructor {
/**
* Creates a byte string from an encoded string.
More information about the nginx-devel
mailing list