# HG changeset patch # User Roman Arutyunyan # Date 1523036066 -10800 # Node ID 6df1a86a60b84e20d2d4265bd1a730ef52c61b52 # Parent 94a598ee1d495708be72265e69738a38fdb0047d Added new njs HTTP properties and methods. diff -r 94a598ee1d49 -r 6df1a86a60b8 xml/en/docs/http/ngx_http_js_module.xml --- a/xml/en/docs/http/ngx_http_js_module.xml Fri Apr 06 20:17:57 2018 +0300 +++ b/xml/en/docs/http/ngx_http_js_module.xml Fri Apr 06 20:34:26 2018 +0300 @@ -9,7 +9,7 @@ + rev="10">
@@ -208,11 +208,73 @@ nginx variables object, read-only +response + +the response object (0.2.0), read-only + + + + + +The request object has the following methods: + + log(string) writes a string to the error log on the info level of logging + +warn(string) + +writes a string to the error log +on the warning level of logging (0.2.0) + + +error(string) + +writes a string to the error log +on the error level of logging (0.2.0) + + +subrequest(uri[, options[, +callback]]) + +creates a subrequest with the given uri and +options, and installs +an optional completion callback (0.2.0). + + +If options is a string, then it +holds the subrequest arguments string. +Otherwise options is expected to be +an object with the following keys: + +args +arguments string + +body +request body + +method +HTTP method + + + + +The callback receives a response object +with the following properties: +uri, method, +status, contentType, +contentLength, headers, +args. +These properties have the same meaning as the request object properties. +Additionally, a reply object has the body property +holding the subrequest response body +and the parent property +referencing the parent request object. + + @@ -260,6 +322,18 @@ finishes sending a response to the client + +return(status[, string]) + +sends +the entire response with the specified status to the client +(0.2.0) + +It is possible to specify either a redirect URL +(for codes 301, 302, 303, 307, and 308) +or the response body text (for other codes) as the second argument. + + diff -r 94a598ee1d49 -r 6df1a86a60b8 xml/ru/docs/http/ngx_http_js_module.xml --- a/xml/ru/docs/http/ngx_http_js_module.xml Fri Apr 06 20:17:57 2018 +0300 +++ b/xml/ru/docs/http/ngx_http_js_module.xml Fri Apr 06 20:34:26 2018 +0300 @@ -9,7 +9,7 @@ + rev="10">
@@ -209,11 +209,73 @@ объект переменных nginx, только чтение +response + +объект ответа (0.2.0), только чтение + + + + + +Объект запроса имеет следующие свойства: + + log(строка) записывает строку в лог-файл ошибок на уровне лога info + +warn(строка) + +записывает строку в лог-файл ошибок +на уровне лога warning (0.2.0) + + +error(строка) + +записывает строку в лог-файл ошибок +на уровне лога error (0.2.0) + + +subrequest(uri[, options[, +callback]]) + +создаёт подзапрос с заданными uri и +options и +устанавливает необязательный callback завершения (0.2.0). + + +Если options является строкой, то в ней +содержится срока аргументов подзапроса. +В противном случае ожидается, что options является объектом +со следующими ключами: + +args +строка с аргументами + +body +тело запроса + +method +метод HTTP + + + + +callback получает объект ответа +со следующими свойствами: +uri, method, +status, contentType, +contentLength, headers, +args. +Эти свойства имеют те же значения, что и свойства объекта запроса. +Дополнительно у объекта ответа есть свойство body, +содержащее тело ответа подзапроса, +и свойство parent, +ссылающееся на родительский объект запроса. + + @@ -263,6 +325,18 @@ завершает отправку ответа клиенту + +return(код[, строка]) + +отправляет +клиенту полный ответ с указанным кодом (0.2.0) + +Можно задать или URL перенаправления +(для кодов 301, 302, 303, 307 и 308), +или текст тела ответа (для остальных кодов) в качестве второго аргумента. + + +