# HG changeset patch # User Yaroslav Zhuravlev # Date 1634233996 -3600 # Node ID bc79ab31073a4157d127630801e3d02dbd323560 # Parent bbe072c9b2784d84e25e2bf6ff5469972228bd3a Documented r.setReturnValue and s.setReturnValue in njs Reference. diff -r bbe072c9b278 -r bc79ab31073a xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml Thu Oct 14 18:53:16 2021 +0100 +++ b/xml/en/docs/njs/reference.xml Thu Oct 14 18:53:16 2021 +0100 @@ -9,7 +9,7 @@
+ rev="77">
@@ -371,6 +371,22 @@ sends the HTTP headers to the client +r.setReturnValue() + +sets the return value of the + handler +(0.7.0). +Unlike an ordinary return statement, +this method should be used when the handler is JS async function. +For example: + +async function js_set(r) { + const digest = await crypto.subtle.digest('SHA-256', r.headersIn.host); + r.setReturnValue(digest); +} + + + r.status status, writable @@ -691,6 +707,22 @@ (since 0.5.2) +s.setReturnValue() + +sets the return value of the + handler +(0.7.0). +Unlike an ordinary return statement, +this method should be used when the handler is JS async function. +For example: + +async function js_set(r) { + const digest = await crypto.subtle.digest('SHA-256', r.headersIn.host); + r.setReturnValue(digest); +} + + + s.variables{} nginx variables object, writable