Use inherited writeHead method signature

The `writeHead` method gets passed through to the native `response.writeHead`. The `Response` interface extends `http.ServerResponse` which defined the `writeHead` method with different arguments. For maintainability reasons, we should just use the inherited method. Also, the current definition makes this method useless (`writeHead` expects at lease one argument).
This commit is contained in:
Niklas Mollenhauer
2017-09-04 22:30:23 +02:00
parent 38894f063d
commit bc54a53ac5
2 changed files with 4 additions and 10 deletions
-9
View File
@@ -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.
+4 -1
View File
@@ -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();
}