1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-17 20:32:41 +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:
Joshua Spence 2015-01-03 09:11:08 +11:00
parent 9f31e023f4
commit 87f11a091d

View file

@ -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);