Previously, r.parent handler threw an exception if it was called not for
a subrequest. This is too restrictive, as it prevents any iterations
over all r properties (for example: JSON.stringify()).
Instead, "undefined" value is returned as it is already done for
r.requestBody when request body is unavailable.
: NULL;
if (ctx == NULL || ctx->vm != vm) {
- njs_vm_error(vm, "parent can only be returned for a subrequest");
- return NJS_ERROR;
+ njs_value_undefined_set(value);
+ return NJS_OK;
}
njs_value_assign(value, njs_value_arg(&ctx->request));