Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mycase/puppeteer-har-server
An HTTP server that exposes functionality offered by puppeteer-har
https://github.com/mycase/puppeteer-har-server
har puppeteer puppeteer-har
Last synced: about 1 month ago
JSON representation
An HTTP server that exposes functionality offered by puppeteer-har
- Host: GitHub
- URL: https://github.com/mycase/puppeteer-har-server
- Owner: mycase
- License: mit
- Created: 2020-02-05T00:41:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T01:30:21.000Z (almost 3 years ago)
- Last Synced: 2024-09-30T07:41:25.638Z (about 2 months ago)
- Topics: har, puppeteer, puppeteer-har
- Language: JavaScript
- Homepage:
- Size: 328 KB
- Stars: 0
- Watchers: 29
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# puppeteer-har-server
This project exposes functionality offered by [`puppeteer-har`] over an HTTP
interface. With it, you can start recording HTTP traffic on a running instance
of Chrome and retrieve that HTTP traffic as an HTTP archive (`.har`).[`puppeteer-har`]: https://github.com/Everettss/puppeteer-har
This project was developed as a way to capture HTTP traffic during automated
acceptance testing. You can configure your tests to start Chrome with
`--remote-debugging-port=9222`. Before each test starts, begin a HAR recording
session. When the test completes, stop the session. Write the HAR archive out
to disk and save it as an artifact in your CI pipeline for later inspection.## Usage
```
npm start
```This exposes a server running on port 3000. If you'd like to use a different
port, specify it using the `PORT` environment variable.```
PORT=8080 npm start
```## API Documentation
### `POST /har-sessions`
Accepts a JSON-encoded request body. It must contain the key `browserURL`,
which corresponds to a Chrome instance's Remote Debugging Protocol interface.It returns a JSON-encoded response body, containing the key `sessionId`.
#### Example
```sh
curl -d '{"browserURL":"http://localhost:9222"}' -H "Content-Type: application/json" -X POST http://localhost:3000/har-sessions
``````
{"sessionId":"3"}
```### `DELETE /har-sessions/:sessionId`
Accepts a `sessionId` in the `path`. Returns a JSON-encoded response body,
containing an HTTP Archive (HAR) with all of the requests from the recording.#### Example
```sh
curl -X DELETE http://localhost:3000/har-sessions/3
``````
{"log":{"version":1.2",...
```## Running tests
To run tests for this project, execute `npm test`. Integration tests drive a
real instance of Chromium, but it is headless by default. To use a non-headless
instance of Chromium during test execution, use the `CHROME_DEBUG` environment
variable.```
CHROME_DEBUG=1 npm test
```