mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 07:51:17 +01:00
only read response.statusCode if response is available
This commit is contained in:
parent
ebd42a1e0f
commit
e093371955
@ -54,9 +54,11 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|||||||
encoding: (options.encoding || null),
|
encoding: (options.encoding || null),
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
// log url + code + description
|
// log url + code + description
|
||||||
var code = response.statusCode;
|
var code = response && response.statusCode;
|
||||||
logfunc = code && code < 405 ? logging.log : logging.warn;
|
if (!error) {
|
||||||
logfunc(rid + url + " " + code + " " + http_code[code]);
|
var logfunc = code && code < 405 ? logging.log : logging.warn;
|
||||||
|
logfunc(rid + url + " " + code + " " + http_code[code]);
|
||||||
|
}
|
||||||
|
|
||||||
// 200 or 301 depending on content type
|
// 200 or 301 depending on content type
|
||||||
if (!error && (code === 200 || code === 301)) {
|
if (!error && (code === 200 || code === 301)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user