-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defect
Milestone
Description
Notice that the response event below has a statusCode of 200 even though the request was aborted by the client. When logging this event, the status code becomes misleading when troubleshooting. Is there a way to set the status code to 499 instead? This seems related to #3561.
{
"event": "response",
"timestamp": 1539281741125,
"id": "1539281741125:localhost:70560:jn4wlokx:10000",
"instance": "http://localhost:8083",
"method": "get",
"path": "/version",
"query": {},
"responseTime": 4022,
"statusCode": 200,
"pid": 70560,
"httpVersion": "1.1",
"source": {
"remoteAddress": "127.0.0.1",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
},
"route": "/version",
"log": [
{
"request": "1539281741125:localhost:70560:jn4wlokx:10000",
"timestamp": 1539281742112,
"tags": [
"request",
"error",
"abort"
],
"channel": "internal"
},
{
"request": "1539281741125:localhost:70560:jn4wlokx:10000",
"timestamp": 1539281745146,
"tags": [
"handler",
"error"
],
"error": {
"data": "adam",
"isBoom": true,
"isServer": true,
"output": {
"statusCode": 500,
"payload": {
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
},
"headers": {}
},
"isDeveloperError": true
},
"channel": "internal"
}
],
"config": {}
}
Also, notice the actual request failed even though the status code is showing as 200. 😕
Route handler looks like:
{
config: {
auth: false,
handler() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject(new Error('adam'));
}, 4000);
});
}
},
method: 'GET',
path: '/version'
}I cancel the request from the browser before it finishes to produce the error.
Context
- node version: 8.11.3
- hapi version: 17.5.4
- hapi good version: 8.1.1
- original issue: Aborted requests show status code 200 in response event outmoded/discuss#729
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defect