What is a HAR file?
The HTTP Archive (HAR) file format allows us to download all of the contents of the "Network" tab in a JSON format. It’s supported by most commonly used browsers: Chrome, FireFox, IE (both Edge and 9+). The file format differs slightly between each of them, but there is a core set of properties that are the same - it was defined by a spec that is now abandoned. |
Why would I want a log of network requests?
- More reliable and quicker debugging
-
The saved log captures all of the calls with payloads and headers and allows for quicker and more accurate debugging than replaying the steps to reproduce the issue in another environment.
- Using a previously saved log to replay or mock calls
-
Downloading the saved log allows us to parse it automatically and to generate mocks for all the endpoints at once. We can also use tools like Charles Proxy to replay the calls.
How do I download the log?
Each browser allows you to download the file through its developer tools interface. The most consistent method is to right click in the network log and to choose "save to HAR." This creates a file with a .har
extension that we can then drag-and-drop back into the network tab or open in an editor.
- Try it with this site right now!
-
Open the network tab in your developer tools for this page. This page has good instructions on downloading the file with the various browsers. You should usually be able to right-click in the log and choose to export/download as HAR.

What can I do with this file?
-
We can use it to mock network requests in your e2e tests
-
We can use it to instantly debug issues
-
We can instruct Charles Proxy to use the HAR directly and to intercept all the calls to our back-end.