mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +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),
|
||||
}, function(error, response, body) {
|
||||
// log url + code + description
|
||||
var code = response.statusCode;
|
||||
logfunc = code && code < 405 ? logging.log : logging.warn;
|
||||
var code = response && response.statusCode;
|
||||
if (!error) {
|
||||
var logfunc = code && code < 405 ? logging.log : logging.warn;
|
||||
logfunc(rid + url + " " + code + " " + http_code[code]);
|
||||
}
|
||||
|
||||
// 200 or 301 depending on content type
|
||||
if (!error && (code === 200 || code === 301)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user