ctx = ngx_http_get_module_ctx(r, ngx_http_js_module);
- if (ctx->vm != vm) {
+ if (r->main != r) {
njs_vm_error(vm, "subrequest can only be created for "
"the primary request");
return NJS_ERROR;
ctx = r->parent ? ngx_http_get_module_ctx(r->parent, ngx_http_js_module)
: NULL;
- if (ctx == NULL || ctx->vm != vm) {
+ if (ctx == NULL) {
njs_value_undefined_set(retval);
return NJS_DECLINED;
}
http_get('/sr_error_in_callback');
+ok(index($t->read_file('error.log'), 'subrequest can only be created for') > 0,
+ 'subrequest creation failed');
+
}
$t->stop();
'subrequest invalid args exception');
ok(index($t->read_file('error.log'), 'too big subrequest response') > 0,
'subrequest too large body');
-ok(index($t->read_file('error.log'), 'subrequest creation failed') > 0,
- 'subrequest creation failed');
ok(index($t->read_file('error.log'),
'js subrequest: failed to get the parent context') > 0,
'zero parent ctx');