Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: res.req only in Node.js, in browser use res.url instead (#798)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw authored Jun 29, 2018
1 parent 3250c73 commit e8a5ab9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/send-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function onRes (buffer, cb) {
const isJson = res.headers['content-type'] &&
res.headers['content-type'].indexOf('application/json') === 0

log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)
if (isNode) {
log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)
} else {
log(res.url, res.statusCode, res.statusMessage)
}

if (res.statusCode >= 400 || !res.statusCode) {
return parseError(res, cb)
Expand Down

0 comments on commit e8a5ab9

Please sign in to comment.