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

fix: res.req only in Node.js, in browser use res.url instead #798

Merged
merged 1 commit into from
Jun 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the method available or just the URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked but did not see the method

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all POST anyway..

}

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