diff options
author | Dmitry Volyntsev <xeioex@nginx.com> | 2020-03-20 17:33:10 +0300 |
---|---|---|
committer | Dmitry Volyntsev <xeioex@nginx.com> | 2020-03-20 17:33:10 +0300 |
commit | c46b4ad7a405a6d316e846219867591ae47d59ba (patch) | |
tree | e9707e4224a585fb08339e29c217262f5b3660fa /nginx/ngx_http_js_module.c | |
parent | fe69071ab7b162ef289d0a5e292695f24fcb7d34 (diff) | |
download | njs-c46b4ad7a405a6d316e846219867591ae47d59ba.tar.gz njs-c46b4ad7a405a6d316e846219867591ae47d59ba.zip |
HTTP: returning undefined value when "responseBody" is unavailable.
Missed in b758915e2406.
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r-- | nginx/ngx_http_js_module.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index a286be9c..1db43ed9 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -2196,7 +2196,12 @@ ngx_http_js_ext_get_response_body(njs_vm_t *vm, njs_object_prop_t *prop, b = r->out ? r->out->buf : NULL; - len = b ? b->last - b->pos : 0; + if (b == NULL) { + njs_value_undefined_set(retval); + return NJS_OK; + } + + len = b->last - b->pos; p = njs_vm_value_string_alloc(vm, retval, len); if (p == NULL) { |