# HG changeset patch # User Yaroslav Zhuravlev # Date 1688643011 -3600 # Node ID 8899986c36221e749fb8ca8c1debed86ad5aa241 # Parent b70e9b8068102d65f3523e98b92172cd6cf694a3 Documented Headers, Request, Response constructors in njs Reference. diff --git a/xml/en/docs/njs/reference.xml b/xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="110">
@@ -922,9 +922,34 @@ is available since 0.7.10) +A new Headers object can be created using the +Headers() constructor: +(since 0.7.10): + + + +Headers([init]) + + + + +init + +An object containing HTTP headers for +prepopulating the Headers object, +can be a string, +an array of name-value pairs, +or an existing Headers object. + + + + + + + + + +A new Headers object can be created with the following properties and methods: @@ -990,8 +1015,53 @@ is available since Request() constructor: + + + +Request[resource[, +options]]) + + +Creates a Request object to fetch +that can be passed later to +ngx.fetch(). +The resource can be a URL +or an existing Request object. +The options is an optional argument +that is expected to be an object with the following keys: + + + +body + +The request body, by default is empty. + + +headers + +The response headers object— +the object containing HTTP headers for +prepopulating the Headers object, +can be a string, +an array of name-value pairs, +or an existing Headers object. + + +method + +The HTTP method, by default the GET method is used. + + + + + + + + + +A new Request object can be created with the following properties and methods: @@ -1067,9 +1137,52 @@ The Response interfac -A new Response object can be created using -the Response() constructor -(since 0.7.10) +A new Response object can be created using the +Response() constructor +(since 0.7.10): + + + +Response[body[, +options]]) + +Creates a Response object. +The body is an optional argument, +can be a string or a buffer, +by default is null. +The options is an optional argument +that is expected to be an object with the following keys: + + + +headers + +The response headers object— +the object containing HTTP headers for +prepopulating the Headers object, +can be a string, +an array of name-value pairs, +or an existing Headers object. + + +status + +The status code of the response. + + +statusText + +The status message corresponding to the status code. + + + + + + + + + +A new Response() object can be created with the following properties and methods: