Skip to content

Commit

Permalink
Merge f2aca82 into 757ff6a
Browse files Browse the repository at this point in the history
  • Loading branch information
exogen committed Jun 13, 2019
2 parents 757ff6a + f2aca82 commit 4729107
Show file tree
Hide file tree
Showing 9 changed files with 529 additions and 496 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ const har = createHarLog(entries);

### …with Isomorphic Fetch

When using “universal” libraries like [isomorphic-fetch][] or [isomorphic-unfetch][],
make sure you only import this library and wrap the Fetch instance on the
server. Not only does this library require built-in Node modules, but it’s
unnecessary in the browser anyway, since you can already spy on requests (and
export HAR logs) via the Network tab.
When using “universal” libraries like [cross-fetch][], [isomorphic-fetch][], or
[isomorphic-unfetch][], **make sure you only import this library and wrap the
Fetch instance on the server.** Not only does this library require built-in Node
modules, but it’s unnecessary in the browser anyway, since you can already spy
on requests (and export HAR logs) via the Network tab.

The following example assumes your bundler (e.g. webpack) is configured to strip
out conditional branches based on `process.browser`.
Expand Down Expand Up @@ -210,6 +210,7 @@ key timestamps and metadata like the HTTP version.
[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[node-fetch]: https://github.com/bitinn/node-fetch
[har]: http://www.softwareishard.com/blog/har-12-spec/
[cross-fetch]: https://github.com/lquixada/cross-fetch
[isomorphic-fetch]: https://github.com/matthew-andrews/isomorphic-fetch
[isomorphic-unfetch]: https://github.com/developit/unfetch
[npm]: https://www.npmjs.com/package/node-fetch-har
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"main": "index.js",
"scripts": {
"lint": "eslint index.js test.js",
"lint": "eslint index.js test",
"start": "cd demo && yarn start",
"test": "yarn run lint && yarn test:coverage",
"test:coverage": "jest --coverage",
Expand All @@ -31,6 +31,7 @@
},
"devDependencies": {
"coveralls": "^3.0.4",
"cross-fetch": "^3.0.4",
"eslint": "^5.16.0",
"isomorphic-fetch": "^2.2.1",
"isomorphic-unfetch": "^3.0.0",
Expand Down
Loading

0 comments on commit 4729107

Please sign in to comment.