Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
},
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
},
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
}
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
},
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
},
if ('string' == typeof val) {
if (setType) this.type = /^\s* this.ctx.onerror(err));
// overwriting
if (null != original && original != val) this.remove('Content-Length');
if (setType) this.type = 'bin';
return;
}
// json
this.remove('Content-Length');
this.type = 'json';
},
function execDuplex (ctx, handler) {
wrapEnd(ctx)
inject(ctx.call, function (err) { onerror(err, ctx) })
ctx.call.on('finish', destroy.bind(null, ctx.call))
handler(ctx).then(() => {
ctx.response.sendMetadata()
}).catch(err => {
ctx.call.emit('error', err)
onerror(err, ctx)
})
}
function execRes (ctx, handler, fn) {
if (isStream(ctx.call)) {
inject(ctx.call, function (err) { onerror(err, ctx) })
onEnd(ctx.call, destroy.bind(null, ctx.call))
}
handler(ctx).then(() => {
ctx.response.sendMetadata()
asCallback(Promise.resolve(ctx.res), (err, response) => {
if (err) {
onerror(err, ctx)
return fn(err)
}
const statusMetadata = ctx.response.getStatusMetadata()
if (response instanceof Error) {
return fn(response, null, statusMetadata)
}
return fn(err, response, statusMetadata)