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

Commit e8a5ab9

Browse files
authored
fix: res.req only in Node.js, in browser use res.url instead (#798)
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
1 parent 3250c73 commit e8a5ab9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/send-request.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ function onRes (buffer, cb) {
3737
const isJson = res.headers['content-type'] &&
3838
res.headers['content-type'].indexOf('application/json') === 0
3939

40-
log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)
40+
if (isNode) {
41+
log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)
42+
} else {
43+
log(res.url, res.statusCode, res.statusMessage)
44+
}
4145

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

0 commit comments

Comments
 (0)