Skip to content

Commit

Permalink
Wrap long lines in README at 80 characters
Browse files Browse the repository at this point in the history
The rendered markdown is unchanged, but this makes it a little easier
to read the file in plaintext.
  • Loading branch information
rmacklin committed Oct 21, 2020
1 parent 4d24f97 commit 6d4c99d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# puppeteer-har-server

This project exposes functionality offered by [`puppeteer-har`][0] 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`).
This project exposes functionality offered by [`puppeteer-har`][0] 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`).

[0]: 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.
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.
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
Expand All @@ -22,7 +29,8 @@ PORT=8080 npm start

### `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.
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`.

Expand All @@ -38,7 +46,8 @@ curl -d '{"browserURL":"http://localhost:9222"}' -H "Content-Type: application/j

### `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.
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

Expand All @@ -52,7 +61,10 @@ curl -X DELETE http://localhost:3000/har-sessions/3

## 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.
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
Expand Down

0 comments on commit 6d4c99d

Please sign in to comment.