mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 21:31:12 +08:00
Merge pull request #19546 from nikeee/fix-writehead
Use inherited `writeHead` method signature
This commit is contained in:
9
types/restify/index.d.ts
vendored
9
types/restify/index.d.ts
vendored
@@ -919,15 +919,6 @@ export interface Response extends http.ServerResponse {
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* pass through to native response.writeHead().
|
||||
* @public
|
||||
* @function writeHead
|
||||
* @emits header
|
||||
* @returns {undefined}
|
||||
*/
|
||||
writeHead(): void;
|
||||
|
||||
/** redirect is sugar method for redirecting.
|
||||
* res.redirect(301, 'www.foo.com', next);
|
||||
* `next` is mandatory, to complete the response and trigger audit logger.
|
||||
|
||||
@@ -95,7 +95,10 @@ function send(req: restify.Request, res: restify.Response, next: restify.Next) {
|
||||
res.id === 'test';
|
||||
|
||||
res.send('hello ' + req.params.name);
|
||||
res.writeHead();
|
||||
res.writeHead(200);
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "application/json"
|
||||
});
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user