mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 03:20:59 +01:00
Minor improvements to handling Aphlict status code
Summary: Self explanatory. Test Plan: `curl`ed a few URLs. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11147
This commit is contained in:
parent
9f31e023f4
commit
87f11a091d
1 changed files with 4 additions and 8 deletions
|
@ -206,23 +206,20 @@ http.createServer(function(request, response) {
|
|||
'<%s> Internal Server Error! %s',
|
||||
request.socket.remoteAddress,
|
||||
err);
|
||||
response.statusCode = 500;
|
||||
response.write('500 Internal Server Error\n');
|
||||
response.writeHead(500, 'Internal Server Error');
|
||||
}
|
||||
} catch (err) {
|
||||
debug.log(
|
||||
'<%s> Bad Request! %s',
|
||||
request.socket.remoteAddress,
|
||||
err);
|
||||
response.statusCode = 400;
|
||||
response.write('400 Bad Request\n');
|
||||
response.writeHead(400, 'Bad Request');
|
||||
} finally {
|
||||
response.end();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
response.statusCode = 405;
|
||||
response.write('405 Method Not Allowed\n');
|
||||
response.writeHead(405, 'Method Not Allowed');
|
||||
response.end();
|
||||
}
|
||||
} else if (request.url == '/status/') {
|
||||
|
@ -240,8 +237,7 @@ http.createServer(function(request, response) {
|
|||
response.write(JSON.stringify(status));
|
||||
response.end();
|
||||
} else {
|
||||
response.statusCode = 404;
|
||||
response.write('404 Not Found\n');
|
||||
response.writeHead(404, 'Not Found');
|
||||
response.end();
|
||||
}
|
||||
}).listen(config.admin, config.host);
|
||||
|
|
Loading…
Reference in a new issue