Full Code of Netflix/pollyjs for AI

master d031861625f5 cached
393 files
1.1 MB
315.1k tokens
585 symbols
1 requests
Download .txt
Showing preview only (1,255K chars total). Download the full file or copy to clipboard to get everything.
Repository: Netflix/pollyjs
Branch: master
Commit: d031861625f5
Files: 393
Total size: 1.1 MB

Directory structure:
gitextract_9hhv16l2/

├── .commitlintrc.js
├── .eslintignore
├── .eslintrc.js
├── .github/
│   ├── issue_template.md
│   └── pull_request_template.md
├── .gitignore
├── .husky/
│   ├── commit-msg
│   └── pre-commit
├── .mocharc.js
├── .prettierrc.js
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── OSSMETADATA
├── README.md
├── docs/
│   ├── .nojekyll
│   ├── _coverpage.md
│   ├── _sidebar.md
│   ├── adapters/
│   │   ├── custom.md
│   │   ├── fetch.md
│   │   ├── node-http.md
│   │   ├── playwright.md
│   │   ├── puppeteer.md
│   │   └── xhr.md
│   ├── api.md
│   ├── assets/
│   │   └── styles.css
│   ├── cli/
│   │   ├── commands.md
│   │   └── overview.md
│   ├── configuration.md
│   ├── examples.md
│   ├── frameworks/
│   │   └── ember-cli.md
│   ├── index.html
│   ├── node-server/
│   │   ├── express-integrations.md
│   │   └── overview.md
│   ├── persisters/
│   │   ├── custom.md
│   │   ├── fs.md
│   │   ├── local-storage.md
│   │   └── rest.md
│   ├── quick-start.md
│   ├── server/
│   │   ├── api.md
│   │   ├── event.md
│   │   ├── events-and-middleware.md
│   │   ├── overview.md
│   │   ├── request.md
│   │   ├── response.md
│   │   └── route-handler.md
│   └── test-frameworks/
│       ├── jest-jasmine.md
│       ├── mocha.md
│       └── qunit.md
├── examples/
│   ├── .eslintrc.js
│   ├── client-server/
│   │   ├── index.html
│   │   ├── package.json
│   │   └── tests/
│   │       ├── events.test.js
│   │       ├── intercept.test.js
│   │       └── setup.js
│   ├── dummy-app/
│   │   ├── .eslintrc.js
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── package.json
│   │   ├── public/
│   │   │   ├── index.html
│   │   │   └── manifest.json
│   │   └── src/
│   │       ├── App.js
│   │       ├── index.css
│   │       ├── index.js
│   │       ├── posts.js
│   │       ├── todos.js
│   │       └── users.js
│   ├── jest-node-fetch/
│   │   ├── .eslintrc.js
│   │   ├── __recordings__/
│   │   │   └── jest-node-fetch_1142061259/
│   │   │       ├── posts_1278140380/
│   │   │       │   └── should-return-post_148615714/
│   │   │       │       └── recording.har
│   │   │       └── users_1585235219/
│   │   │           └── should-return-user_4259424139/
│   │   │               └── recording.har
│   │   ├── __tests__/
│   │   │   └── index.test.js
│   │   ├── package.json
│   │   └── src/
│   │       ├── index.js
│   │       ├── posts.js
│   │       └── users.js
│   ├── jest-puppeteer/
│   │   ├── .eslintrc.js
│   │   ├── __recordings__/
│   │   │   └── jest-puppeteer_2726822272/
│   │   │       └── should-be-able-to-navigate-to-all-routes_1130491217/
│   │   │           └── recording.har
│   │   ├── __tests__/
│   │   │   └── dummy-app.test.js
│   │   ├── jest-puppeteer.config.js
│   │   ├── jest.config.js
│   │   └── package.json
│   ├── node-fetch/
│   │   ├── package.json
│   │   ├── recordings/
│   │   │   └── node-fetch_2851505768/
│   │   │       └── should-work_3457346403/
│   │   │           └── recording.har
│   │   └── tests/
│   │       └── node-fetch.test.js
│   ├── puppeteer/
│   │   ├── index.js
│   │   ├── package.json
│   │   └── recordings/
│   │       └── puppeteer_2155046665/
│   │           └── recording.har
│   ├── rest-persister/
│   │   ├── index.html
│   │   ├── package.json
│   │   ├── recordings/
│   │   │   └── REST-Persister_2289553200/
│   │   │       └── should-work_3457346403/
│   │   │           └── recording.har
│   │   └── tests/
│   │       ├── rest-persister.test.js
│   │       └── setup.js
│   └── typescript-jest-node-fetch/
│       ├── __recordings__/
│       │   └── github-api-client_2139812550/
│       │       └── getUser_1648904580/
│       │           └── recording.har
│       ├── jest.config.ts
│       ├── package.json
│       ├── src/
│       │   ├── github-api.test.ts
│       │   ├── github-api.ts
│       │   └── utils/
│       │       └── auto-setup-polly.ts
│       └── tsconfig.json
├── jest.config.js
├── lerna.json
├── package.json
├── packages/
│   └── @pollyjs/
│       ├── adapter/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── dehumanize-time.js
│       │   │       ├── is-expired.js
│       │   │       ├── normalize-recorded-response.js
│       │   │       └── stringify-request.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── adapter-test.js
│       │   │       └── utils/
│       │   │           ├── dehumanize-time-test.js
│       │   │           └── is-expired-test.js
│       │   └── types.d.ts
│       ├── adapter-fetch/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       └── serializer-headers.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   ├── adapter-test.js
│       │   │   │   ├── persister-local-storage-test.js
│       │   │   │   ├── persister-rest-test.js
│       │   │   │   └── server-test.js
│       │   │   └── utils/
│       │   │       └── polly-config.js
│       │   └── types.d.ts
│       ├── adapter-node-http/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.shared.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── get-url-from-options.js
│       │   │       ├── merge-chunks.js
│       │   │       └── url-to-options.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   ├── adapter-node-fetch-test.js
│       │   │   │   ├── adapter-test.js
│       │   │   │   └── persister-fs-test.js
│       │   │   ├── jest/
│       │   │   │   └── integration/
│       │   │   │       ├── fetch-test.js
│       │   │   │       └── xhr-test.js
│       │   │   ├── unit/
│       │   │   │   └── utils/
│       │   │   │       └── merge-chunks-test.js
│       │   │   └── utils/
│       │   │       ├── get-buffer-from-stream.js
│       │   │       ├── get-response-from-request.js
│       │   │       ├── native-request.js
│       │   │       └── polly-config.js
│       │   └── types.d.ts
│       ├── adapter-puppeteer/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   ├── helpers/
│       │   │   │   └── fetch.js
│       │   │   ├── integration/
│       │   │   │   └── adapter-test.js
│       │   │   └── unit/
│       │   │       └── adapter-test.js
│       │   └── types.d.ts
│       ├── adapter-xhr/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── resolve-xhr.js
│       │   │       └── serialize-response-headers.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   └── adapter-test.js
│       │   │   └── utils/
│       │   │       └── xhr-request.js
│       │   └── types.d.ts
│       ├── cli/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── bin/
│       │   │   └── cli.js
│       │   └── package.json
│       ├── core/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── -private/
│       │   │   │   ├── container.js
│       │   │   │   ├── event-emitter.js
│       │   │   │   ├── event.js
│       │   │   │   ├── http-base.js
│       │   │   │   ├── interceptor.js
│       │   │   │   ├── logger.js
│       │   │   │   ├── request.js
│       │   │   │   └── response.js
│       │   │   ├── defaults/
│       │   │   │   └── config.js
│       │   │   ├── index.js
│       │   │   ├── polly.js
│       │   │   ├── server/
│       │   │   │   ├── handler.js
│       │   │   │   ├── index.js
│       │   │   │   ├── middleware.js
│       │   │   │   └── route.js
│       │   │   ├── test-helpers/
│       │   │   │   ├── lib.js
│       │   │   │   ├── mocha.js
│       │   │   │   └── qunit.js
│       │   │   └── utils/
│       │   │       ├── cancel-fn-after-n-times.js
│       │   │       ├── deferred-promise.js
│       │   │       ├── guid-for-recording.js
│       │   │       ├── http-headers.js
│       │   │       ├── merge-configs.js
│       │   │       ├── normalize-request.js
│       │   │       ├── parse-url.js
│       │   │       ├── remove-host-from-url.js
│       │   │       ├── timing.js
│       │   │       └── validators.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── -private/
│       │   │       │   ├── container-test.js
│       │   │       │   ├── event-emitter-test.js
│       │   │       │   ├── event-test.js
│       │   │       │   ├── http-base-test.js
│       │   │       │   ├── interceptor-test.js
│       │   │       │   └── response-test.js
│       │   │       ├── index-test.js
│       │   │       ├── polly-test.js
│       │   │       ├── server/
│       │   │       │   ├── handler-test.js
│       │   │       │   └── server-test.js
│       │   │       ├── test-helpers/
│       │   │       │   └── mocha-test.js
│       │   │       └── utils/
│       │   │           ├── deferred-promise-test.js
│       │   │           ├── guid-for-recording-test.js
│       │   │           ├── http-headers-test.js
│       │   │           ├── merge-configs-test.js
│       │   │           ├── normalize-request-test.js
│       │   │           ├── parse-url-test.js
│       │   │           ├── remove-host-from-url-test.js
│       │   │           └── timing-test.js
│       │   └── types.d.ts
│       ├── ember/
│       │   ├── .editorconfig
│       │   ├── .ember-cli
│       │   ├── .eslintignore
│       │   ├── .eslintrc.js
│       │   ├── .gitignore
│       │   ├── .npmignore
│       │   ├── .prettierignore
│       │   ├── .prettierrc.js
│       │   ├── .template-lintrc.js
│       │   ├── .watchmanconfig
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── addon/
│       │   │   └── -private/
│       │   │       └── preconfigure.js
│       │   ├── blueprints/
│       │   │   └── @pollyjs/
│       │   │       └── ember/
│       │   │           ├── files/
│       │   │           │   └── config/
│       │   │           │       └── polly.js
│       │   │           └── index.js
│       │   ├── config/
│       │   │   ├── ember-try.js
│       │   │   ├── environment.js
│       │   │   └── polly.js
│       │   ├── ember-cli-build.js
│       │   ├── index.js
│       │   ├── package.json
│       │   ├── testem.js
│       │   ├── tests/
│       │   │   ├── dummy/
│       │   │   │   ├── app/
│       │   │   │   │   ├── app.js
│       │   │   │   │   ├── components/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── controllers/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── helpers/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── index.html
│       │   │   │   │   ├── models/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── router.js
│       │   │   │   │   ├── routes/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── styles/
│       │   │   │   │   │   └── app.css
│       │   │   │   │   └── templates/
│       │   │   │   │       └── application.hbs
│       │   │   │   ├── config/
│       │   │   │   │   ├── ember-cli-update.json
│       │   │   │   │   ├── environment.js
│       │   │   │   │   ├── optional-features.json
│       │   │   │   │   └── targets.js
│       │   │   │   └── public/
│       │   │   │       └── robots.txt
│       │   │   ├── helpers/
│       │   │   │   └── .gitkeep
│       │   │   ├── index.html
│       │   │   ├── integration/
│       │   │   │   └── .gitkeep
│       │   │   ├── test-helper.js
│       │   │   └── unit/
│       │   │       └── polly-test.js
│       │   └── vendor/
│       │       └── .gitkeep
│       ├── node-server/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── src/
│       │   │   ├── api.js
│       │   │   ├── config.js
│       │   │   ├── express/
│       │   │   │   └── register-api.js
│       │   │   ├── index.js
│       │   │   └── server.js
│       │   └── types.d.ts
│       ├── persister/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── har/
│       │   │   │   ├── entry.js
│       │   │   │   ├── index.js
│       │   │   │   ├── log.js
│       │   │   │   ├── request.js
│       │   │   │   ├── response.js
│       │   │   │   └── utils/
│       │   │   │       ├── get-first-header.js
│       │   │   │       └── to-nv-pairs.js
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── har-test.js
│       │   │       └── persister-test.js
│       │   └── types.d.ts
│       ├── persister-fs/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       └── persister-test.js
│       │   └── types.d.ts
│       ├── persister-in-memory/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   └── types.d.ts
│       ├── persister-local-storage/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   └── types.d.ts
│       ├── persister-rest/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── ajax.js
│       │   │   └── index.js
│       │   └── types.d.ts
│       └── utils/
│           ├── CHANGELOG.md
│           ├── LICENSE
│           ├── README.md
│           ├── package.json
│           ├── rollup.config.test.js
│           ├── src/
│           │   ├── constants/
│           │   │   ├── actions.js
│           │   │   ├── expiry-strategies.js
│           │   │   ├── http-methods.js
│           │   │   ├── http-status-codes.js
│           │   │   └── modes.js
│           │   ├── index.js
│           │   └── utils/
│           │       ├── assert.js
│           │       ├── build-url.js
│           │       ├── clone-arraybuffer.js
│           │       ├── is-buffer-utf8-representable.js
│           │       ├── polly-error.js
│           │       ├── serializers/
│           │       │   ├── blob.js
│           │       │   ├── buffer.js
│           │       │   ├── form-data.js
│           │       │   └── index.js
│           │       ├── timeout.js
│           │       ├── timestamp.js
│           │       └── url.js
│           ├── tests/
│           │   ├── browser/
│           │   │   └── unit/
│           │   │       └── utils/
│           │   │           └── serializers/
│           │   │               ├── blob.js
│           │   │               └── form-data.js
│           │   ├── node/
│           │   │   └── unit/
│           │   │       └── utils/
│           │   │           └── serializers/
│           │   │               └── buffer.js
│           │   ├── serializer-tests.js
│           │   └── unit/
│           │       └── utils/
│           │           ├── assert-test.js
│           │           ├── build-url-test.js
│           │           ├── polly-error-test.js
│           │           ├── timeout-test.js
│           │           ├── timestamp-test.js
│           │           └── url-test.js
│           └── types.d.ts
├── scripts/
│   ├── require-clean-work-tree.sh
│   ├── require-test-build.sh
│   └── rollup/
│       ├── browser.config.js
│       ├── browser.test.config.js
│       ├── default.config.js
│       ├── jest.test.config.js
│       ├── node.config.js
│       ├── node.test.config.js
│       └── utils.js
├── testem.js
└── tests/
    ├── helpers/
    │   ├── file.js
    │   ├── global-node-fetch.js
    │   ├── setup-fetch-record.js
    │   └── setup-persister.js
    ├── index.mustache
    ├── integration/
    │   ├── adapter-browser-tests.js
    │   ├── adapter-identifier-tests.js
    │   ├── adapter-node-tests.js
    │   ├── adapter-polly-tests.js
    │   ├── adapter-tests.js
    │   └── persister-tests.js
    ├── middleware.js
    └── node-setup.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .commitlintrc.js
================================================
/* eslint-env node */

module.exports = {
  extends: [
    '@commitlint/config-lerna-scopes',
    '@commitlint/config-conventional'
  ],
  rules: {
    'subject-case': [2, 'always', ['sentence-case']]
  }
};


================================================
FILE: .eslintignore
================================================
/packages/@pollyjs/ember/tests/**/index.html
CHANGELOG.md
package.json
node_modules
tmp
build
dist


================================================
FILE: .eslintrc.js
================================================
/* eslint-env node */

module.exports = {
  root: true,
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module'
  },
  plugins: ['import'],
  extends: ['eslint:recommended', 'plugin:prettier/recommended'],
  globals: {
    global: true
  },
  env: {
    browser: true,
    es6: true
  },
  rules: {
    'no-console': 'off',
    'prefer-const': 'error',
    'getter-return': 'error',
    'padding-line-between-statements': [
      'error',
      // require blank lines before all return statements,
      { blankLine: 'always', prev: '*', next: 'return' },

      // Require blank lines after every sequence of variable declarations
      { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
      {
        blankLine: 'any',
        prev: ['const', 'let', 'var'],
        next: ['const', 'let', 'var']
      }
    ],
    'no-restricted-properties': [
      2,
      {
        object: 'Object',
        property: 'assign',
        message: 'Please use the spread operator instead.'
      }
    ],
    // Require that imports occur at the top of the file
    'import/first': 'error',

    // Require imports to be grouped and ordered consistently
    'import/order': [
      'error',
      {
        'newlines-between': 'always'
      }
    ]
  },
  overrides: [
    // test files
    {
      files: ['tests/**/*.js', '**/*/tests/**/*.js'],
      env: {
        mocha: true
      },
      globals: {
        chai: true,
        expect: true
      }
    },
    {
      files: ['**/*/tests/node/**/*.js'],
      env: {
        browser: false
      }
    },
    {
      files: ['**/*/tests/jest/**/*.js'],
      env: {
        jest: true,
        mocha: false
      }
    }
  ]
};


================================================
FILE: .github/issue_template.md
================================================
## Prerequisites

- We realize there is a lot of data requested here. We ask only that you do your best to provide as much information as possible so we can better help you.
- Read the [contributing guidelines](https://github.com/Netflix/pollyjs/blob/master/CONTRIBUTING.md).
- Ensure the issue isn't already reported.
- Should be reproducible with the latest @pollyjs package versions.

> _Delete the above section and the instructions in the sections below before submitting_

## Description

If this is a feature request, explain why it should be added. Specific use-cases are best.

For bug reports, please provide as much _relevant_ info as possible.

### Shareable Source

```js
// Avoid posting hundreds of lines of source code.
// Edit to just the relevant portions.
```

### Error Message & Stack Trace

```
COPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE
```

### Config

Copy the config used to setup the Polly instance:

```js
new Polly('Recording Name', {
  // config...
});
```

### Dependencies

Copy the @pollyjs dependencies from `package.json`:

```json
{
  "@pollyjs/core": "latest",
  "@pollyjs/adapter-x": "latest",
  "@pollyjs/persister-x": "latest"
}
```

## Relevant Links

- If your project is public, link to the repo so we can investigate directly.
- **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support.

## Environment

Tell us which operating system you are using, as well as which versions of Node.js and npm/yarn. If applicable, include the browser and the corresponding version.

Run the following to get it quickly:

```
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
npm --version
yarn --version
```


================================================
FILE: .github/pull_request_template.md
================================================
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Motivation and Context

<!---
  Why is this change required? What problem does it solve?

  If it fixes an open issue, please link to the issue here.
-->

## Types of Changes

<!---
  What types of changes does your code introduce? Put an `x` in all the boxes that apply:
-->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

<!---
  Go over all the following points, and put an `x` in all the boxes that apply.

  If you're unsure about any of these, don't hesitate to ask. We're here to help!
-->

- [ ] I have added tests to cover my changes.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] My code follows the code style of this project.
- [ ] My commits and the title of this PR follow the [Conventional Commits Specification](https://www.conventionalcommits.org).
- [ ] I have read the [contributing guidelines](https://github.com/Netflix/pollyjs/blob/master/CONTRIBUTING.md).


================================================
FILE: .gitignore
================================================
.DS_Store
node_modules
package-lock.json
lerna-debug.log
packages/**/dist/
yarn-error.log
tmp
build
dist
*.lerna_backup
.npmrc

# Test recordings can write be written here if the test job did not
# get a chance to run to completion.  The test will cleans these files up afterwards.
/recordings

# Examples
examples/**/*/yarn.lock

# IDE
.vscode/
.tool-versions


================================================
FILE: .husky/commit-msg
================================================
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit "$1"


================================================
FILE: .husky/pre-commit
================================================
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged


================================================
FILE: .mocharc.js
================================================
module.exports = {
  spec: './packages/@pollyjs/*/build/node/*.js',
  ui: 'bdd',
  require: 'tests/node-setup.js'
};


================================================
FILE: .prettierrc.js
================================================
'use strict';

module.exports = {
  singleQuote: true,
  trailingComma: 'none'
};


================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
  - '12'
  - '14'
  - '16'

addons:
  chrome: stable

cache:
  yarn: true

before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash
  - export PATH=$HOME/.yarn/bin:$PATH

install:
  - yarn install --frozen-lockfile --non-interactive

script:
  - commitlint-travis
  - yarn run test:ci
  - ./scripts/require-clean-work-tree.sh


================================================
FILE: CHANGELOG.md
================================================
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.0.7](https://github.com/netflix/pollyjs/compare/v6.0.6...v6.0.7) (2025-05-31)


### Bug Fixes

* Undeprecating fetch for node because node supports fetch now ([#506](https://github.com/netflix/pollyjs/issues/506)) ([be0bd6c](https://github.com/netflix/pollyjs/commit/be0bd6ca0035565a1c29770bfc87f0b0754fec27))





## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)

**Note:** Version bump only for package pollyjs





## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)


### Bug Fixes

* **persister:** `requests` -> `request` in `HarEntry` declaration ([#441](https://github.com/netflix/pollyjs/issues/441)) ([6466810](https://github.com/netflix/pollyjs/commit/6466810677b6ac2c6a7496335bf40e043ab843e1))





## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)


### Bug Fixes

* Update types for class methods ([#438](https://github.com/netflix/pollyjs/issues/438)) ([b88655a](https://github.com/netflix/pollyjs/commit/b88655ac1b4ca7348afd45e9aeaa50e998ea68d7))





## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)


### Bug Fixes

* A few more type fixes ([#437](https://github.com/netflix/pollyjs/issues/437)) ([5e837a2](https://github.com/netflix/pollyjs/commit/5e837a25d28393b764cb66bcae0b29e9273eabe8))





## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)


### Bug Fixes

* **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ([cc2fa19](https://github.com/netflix/pollyjs/commit/cc2fa197a5c0a5fdef4602c4a207d31f3e677897))





## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)


### Bug Fixes

* **ember:** Bump peer dependencies to 6.x ([#432](https://github.com/netflix/pollyjs/issues/432)) ([1529226](https://github.com/netflix/pollyjs/commit/152922688744c8a2f8d89f793dcecf3c2bc40033))
* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))





# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)


### Bug Fixes

* **persister:** Only treat status codes >= 400 as failed ([#430](https://github.com/netflix/pollyjs/issues/430)) ([7658952](https://github.com/netflix/pollyjs/commit/765895232746cd560da6bd566de8a312045b1703))


* fix!: Upgrade url-parse (#426) ([c21ed04](https://github.com/netflix/pollyjs/commit/c21ed048ff9d87a3773458dcfb9758e4fa6582bf)), closes [#426](https://github.com/netflix/pollyjs/issues/426)
* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)
* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)
* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)
* feat!: Use base64 instead of hex encoding for binary data (#420) ([6bb9b36](https://github.com/netflix/pollyjs/commit/6bb9b36522d73f9c079735d9006a12376aee39ea)), closes [#420](https://github.com/netflix/pollyjs/issues/420)
* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)


### Features

* **adapter-node-http:** Upgrade nock to v13 ([#424](https://github.com/netflix/pollyjs/issues/424)) ([2d5b59e](https://github.com/netflix/pollyjs/commit/2d5b59ee0c33ea53a64321249246fcae0a616a3f))
* **node-server:** Upgrade dependencies ([#417](https://github.com/netflix/pollyjs/issues/417)) ([246a2f2](https://github.com/netflix/pollyjs/commit/246a2f29a88de9c25fc0739ea5e53a0130a58573))


### BREAKING CHANGES

* Upgrade url-parse to 1.5.0+ to fix CVE-2021-27515. This change could alter the final url generated for a request. 
* Adapter
	- `passthroughRequest` renamed to `onFetchResponse`
	- `respondToRequest` renamed to `onRespond`
* Persister
	- `findRecording` renamed to `onFindRecording`
	- `saveRecording` renamed to `onSaveRecording`
	- `deleteRecording` renamed to `onDeleteRecording`
* The `logging` configuration option has now been replaced with `logLevel`. This allows for more fine-grain control over what should be logged as well as silencing logs altogether. 
* Recording file name will no longer have trailing dashes
* Use the standard `encoding` field on the generated har file instead of `_isBinary` and use `base64` encoding instead of `hex` to reduce the payload size.
	* Although backwards compatibility is not guaranteed, you can replace all occurrences of `"_isBinary": true` with `"encoding": "hex"` in the recorded HAR files.
* @pollyjs dependencies for @pollyjs/ember have been moved to peer dependencies





# [5.2.0](https://github.com/netflix/pollyjs/compare/v5.1.1...v5.2.0) (2021-11-24)


### Features

* **ember:** Upgrade ember-cli-babel to ^7.26.6 ([#411](https://github.com/netflix/pollyjs/issues/411)) ([4352881](https://github.com/netflix/pollyjs/commit/4352881))





## [5.1.1](https://github.com/netflix/pollyjs/compare/v5.1.0...v5.1.1) (2021-06-02)


### Bug Fixes

* Handle failed arraybuffer instanceof checks ([#393](https://github.com/netflix/pollyjs/issues/393)) ([247be0a](https://github.com/netflix/pollyjs/commit/247be0a))





# [5.1.0](https://github.com/netflix/pollyjs/compare/v5.0.2...v5.1.0) (2020-12-12)


### Bug Fixes

* **adapter-puppeteer:** Add prependListener puppeteer@4.0.0 removed ([#368](https://github.com/netflix/pollyjs/issues/368)) ([6c35fd3](https://github.com/netflix/pollyjs/commit/6c35fd3))


### Features

* **core:** Add `overrideRecordingName` and `configure` to public API ([#372](https://github.com/netflix/pollyjs/issues/372)) ([cdbf513](https://github.com/netflix/pollyjs/commit/cdbf513))





## [5.0.2](https://github.com/netflix/pollyjs/compare/v5.0.1...v5.0.2) (2020-12-06)


### Bug Fixes

* **adapter-node-http:** Remove module monkey patching on disconnect ([#369](https://github.com/netflix/pollyjs/issues/369)) ([0cec43a](https://github.com/netflix/pollyjs/commit/0cec43a))





## [5.0.1](https://github.com/netflix/pollyjs/compare/v5.0.0...v5.0.1) (2020-09-25)


### Bug Fixes

* **adapter-xhr:** Only modify the `responseType` if it was changed ([#363](https://github.com/netflix/pollyjs/issues/363)) ([cff4e2d](https://github.com/netflix/pollyjs/commit/cff4e2d))





# [5.0.0](https://github.com/netflix/pollyjs/compare/v4.3.0...v5.0.0) (2020-06-23)


### Bug Fixes

* **adapter-fetch:** Add statusText to the response ([#341](https://github.com/netflix/pollyjs/issues/341)) ([0d45953](https://github.com/netflix/pollyjs/commit/0d45953))
* **core:** Compute order based on id and recording name ([#342](https://github.com/netflix/pollyjs/issues/342)) ([42004d2](https://github.com/netflix/pollyjs/commit/42004d2))


### Features

* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/commit/1223ba0))


### BREAKING CHANGES

* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id
* **core:** A request's order is will now be computed based on its id and the recording name it will be persisted to.





# [4.3.0](https://github.com/netflix/pollyjs/compare/v4.2.1...v4.3.0) (2020-05-18)


### Features

* **adapter-fetch:** Add support for handling binary data ([#332](https://github.com/netflix/pollyjs/issues/332)) ([111bebf](https://github.com/netflix/pollyjs/commit/111bebf))
* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/commit/48ea1d7))
* **core:** Add `flushRequestsOnStop` configuration option ([#335](https://github.com/netflix/pollyjs/issues/335)) ([ab4a2e1](https://github.com/netflix/pollyjs/commit/ab4a2e1))





## [4.2.1](https://github.com/netflix/pollyjs/compare/v4.2.0...v4.2.1) (2020-04-30)


### Bug Fixes

* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/issues/329)) ([9466989](https://github.com/netflix/pollyjs/commit/9466989))





# [4.2.0](https://github.com/netflix/pollyjs/compare/v4.1.0...v4.2.0) (2020-04-29)


### Features

* **node-server:** Pass options to the CORS middleware via `corsOptions` ([3d991f5](https://github.com/netflix/pollyjs/commit/3d991f5))





# [4.1.0](https://github.com/netflix/pollyjs/compare/v4.0.4...v4.1.0) (2020-04-23)


### Bug Fixes

* Improve abort handling ([#320](https://github.com/netflix/pollyjs/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/commit/cc46bb4))
* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/commit/8fd4d19))


### Features

* **persister:** Add `disableSortingHarEntries` option ([#321](https://github.com/netflix/pollyjs/issues/321)) ([0003c0e](https://github.com/netflix/pollyjs/commit/0003c0e))





## [4.0.4](https://github.com/netflix/pollyjs/compare/v4.0.3...v4.0.4) (2020-03-21)


### Bug Fixes

* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/commit/41dd093))
* **adapter-node-http:** Bump nock version ([#319](https://github.com/netflix/pollyjs/issues/319)) ([7d361a6](https://github.com/netflix/pollyjs/commit/7d361a6))





## [4.0.3](https://github.com/netflix/pollyjs/compare/v4.0.2...v4.0.3) (2020-01-30)


### Bug Fixes

* **adapter-node-http:** Use requestBodyBuffers to parse body ([#304](https://github.com/netflix/pollyjs/issues/304)) ([113fec5](https://github.com/netflix/pollyjs/commit/113fec5))





## [4.0.2](https://github.com/netflix/pollyjs/compare/v4.0.1...v4.0.2) (2020-01-29)


### Bug Fixes

* **core:** Strict null query param handling ([#302](https://github.com/netflix/pollyjs/issues/302)) ([5cf70aa](https://github.com/netflix/pollyjs/commit/5cf70aa))





## [4.0.1](https://github.com/netflix/pollyjs/compare/v4.0.0...v4.0.1) (2020-01-25)


### Bug Fixes

* **ember:** Config read from project root ([7d6da38](https://github.com/netflix/pollyjs/commit/7d6da38))





# [4.0.0](https://github.com/netflix/pollyjs/compare/v3.0.2...v4.0.0) (2020-01-13)


### Bug Fixes

* **adapter:** Clone the recording entry before mutating it ([#294](https://github.com/netflix/pollyjs/issues/294)) ([d7e1303](https://github.com/netflix/pollyjs/commit/d7e1303))
* **core:** Disconnect from all adapters when `pause` is called ([#291](https://github.com/netflix/pollyjs/issues/291)) ([5c655bf](https://github.com/netflix/pollyjs/commit/5c655bf))


### chore

* Drop node 8 support ([#292](https://github.com/netflix/pollyjs/issues/292)) ([4448be5](https://github.com/netflix/pollyjs/commit/4448be5))


### Features

* **core:** Provide the request as an argument to matchRequestsBy methods ([#293](https://github.com/netflix/pollyjs/issues/293)) ([4e3163f](https://github.com/netflix/pollyjs/commit/4e3163f))
* **core:** Remove deprecated `recordIfExpired` option ([#295](https://github.com/netflix/pollyjs/issues/295)) ([5fe991d](https://github.com/netflix/pollyjs/commit/5fe991d))


### BREAKING CHANGES

* **core:** `recordIfExpired` is no longer supported, please use `expiryStrategy` instead.
* Drop support for Node 8 as it is now EOL
* **core:** Calling `polly.pause()` will now disconnect from all connected adapters instead of setting the mode to passthrough. Calling `polly.play()` will reconnect to the disconnected adapters before pause was called.





## [3.0.2](https://github.com/netflix/pollyjs/compare/v3.0.1...v3.0.2) (2020-01-08)


### Bug Fixes

* **adapter-node-http:** Bump nock version to correctly handle re… ([#289](https://github.com/netflix/pollyjs/issues/289)) ([8d0ae97](https://github.com/netflix/pollyjs/commit/8d0ae97)), closes [#278](https://github.com/netflix/pollyjs/issues/278)





## [3.0.1](https://github.com/netflix/pollyjs/compare/v3.0.0...v3.0.1) (2019-12-25)


### Bug Fixes

* **adapter-fetch:** Fix "failed to construct Request" issue ([#287](https://github.com/netflix/pollyjs/issues/287)) ([d17ab9b](https://github.com/netflix/pollyjs/commit/d17ab9b)), closes [#286](https://github.com/netflix/pollyjs/issues/286)





# [3.0.0](https://github.com/netflix/pollyjs/compare/v2.7.0...v3.0.0) (2019-12-18)


### Bug Fixes

* **ember:** loads polly config for ember by its own module ([#277](https://github.com/netflix/pollyjs/issues/277)) ([0569040](https://github.com/netflix/pollyjs/commit/0569040))


### BREAKING CHANGES

* **ember:** moves location of polly configuration





# [2.7.0](https://github.com/netflix/pollyjs/compare/v2.6.3...v2.7.0) (2019-11-21)


### Bug Fixes

* **adapter-node-http:** Correctly handle uploading binary data ([#257](https://github.com/netflix/pollyjs/issues/257)) ([31f0e0a](https://github.com/netflix/pollyjs/commit/31f0e0a))


### Features

* **adapter-node-http:** Upgrade nock to v11.x ([#273](https://github.com/netflix/pollyjs/issues/273)) ([5d42cbd](https://github.com/netflix/pollyjs/commit/5d42cbd))





## [2.6.3](https://github.com/netflix/pollyjs/compare/v2.6.2...v2.6.3) (2019-09-30)


### Bug Fixes

* use watch strategy ([#236](https://github.com/netflix/pollyjs/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/commit/5b4edf3))
* **adapter-fetch:** Correctly handle Request instance passed into fetch ([#259](https://github.com/netflix/pollyjs/issues/259)) ([593ecb9](https://github.com/netflix/pollyjs/commit/593ecb9))





## [2.6.2](https://github.com/netflix/pollyjs/compare/v2.6.1...v2.6.2) (2019-08-05)


### Bug Fixes

* Bowser.getParser empty string UserAgent error ([#246](https://github.com/netflix/pollyjs/issues/246)) ([2c9c4b9](https://github.com/netflix/pollyjs/commit/2c9c4b9))


### Features

* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/commit/5a6fda6))





## [2.6.1](https://github.com/netflix/pollyjs/compare/v2.6.0...v2.6.1) (2019-08-01)


### Bug Fixes

* **persister:** Default to empty string if userAgent is empty ([#242](https://github.com/netflix/pollyjs/issues/242)) ([c46d65c](https://github.com/netflix/pollyjs/commit/c46d65c))





# [2.6.0](https://github.com/netflix/pollyjs/compare/v2.5.0...v2.6.0) (2019-07-17)


### Bug Fixes

* **adapter-fetch:** Handle `Request` objects as URLs ([#220](https://github.com/netflix/pollyjs/issues/220)) ([bb28d54](https://github.com/netflix/pollyjs/commit/bb28d54))


### Features

* **core:** Improved logging ([#217](https://github.com/netflix/pollyjs/issues/217)) ([3e876a8](https://github.com/netflix/pollyjs/commit/3e876a8))
* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/commit/23a2127))





# [2.5.0](https://github.com/netflix/pollyjs/compare/v2.4.0...v2.5.0) (2019-06-06)


### Features

* **adapter-xhr:** Support `context` option ([65b3c38](https://github.com/netflix/pollyjs/commit/65b3c38))





# [2.4.0](https://github.com/netflix/pollyjs/compare/v2.3.2...v2.4.0) (2019-04-27)


### Features

* **core:** Improved control flow with `times` and `stopPropagation` ([#202](https://github.com/netflix/pollyjs/issues/202)) ([2c8231e](https://github.com/netflix/pollyjs/commit/2c8231e))





## [2.3.2](https://github.com/netflix/pollyjs/compare/v2.3.1...v2.3.2) (2019-04-09)


### Bug Fixes

* **adapter-puppeteer:** Remove other resource type matching ([#197](https://github.com/netflix/pollyjs/issues/197)) ([ea6bfcc](https://github.com/netflix/pollyjs/commit/ea6bfcc))





## [2.3.1](https://github.com/netflix/pollyjs/compare/v2.3.0...v2.3.1) (2019-03-06)


### Bug Fixes

* **adapter-fetch:** Correctly handle key/value pairs headers ([dc0323d](https://github.com/netflix/pollyjs/commit/dc0323d))





# [2.3.0](https://github.com/netflix/pollyjs/compare/v2.2.0...v2.3.0) (2019-02-27)


### Features

* **core:** Filter requests matched by a route handler ([#189](https://github.com/netflix/pollyjs/issues/189)) ([5d57c32](https://github.com/netflix/pollyjs/commit/5d57c32))





# [2.2.0](https://github.com/netflix/pollyjs/compare/v2.1.0...v2.2.0) (2019-02-20)


### Features

* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/commit/3694ebc))





# [2.1.0](https://github.com/netflix/pollyjs/compare/v2.0.0...v2.1.0) (2019-02-04)


### Bug Fixes

* **adapter:** Log information if request couldn't be found in recording ([#172](https://github.com/netflix/pollyjs/issues/172)) ([8dcdf7b](https://github.com/netflix/pollyjs/commit/8dcdf7b))
* **adapter-xhr:** Xhr.send should not be an async method ([#173](https://github.com/netflix/pollyjs/issues/173)) ([eb3a6eb](https://github.com/netflix/pollyjs/commit/eb3a6eb))
* Correctly handle array header values ([#179](https://github.com/netflix/pollyjs/issues/179)) ([fb7dbb4](https://github.com/netflix/pollyjs/commit/fb7dbb4))


### Features

* **core:** Add removeHeader, removeHeaders, and allow empty headers ([#176](https://github.com/netflix/pollyjs/issues/176)) ([1dfae5a](https://github.com/netflix/pollyjs/commit/1dfae5a))





# [2.0.0](https://github.com/netflix/pollyjs/compare/v1.4.2...v2.0.0) (2019-01-29)


*  feat(adapter-node-http): Use `nock` under the hood instead of custom implementation (#166) ([62374f4](https://github.com/netflix/pollyjs/commit/62374f4)), closes [#166](https://github.com/netflix/pollyjs/issues/166)


### Bug Fixes

* **adapter:** Test for navigator before accessing ([#165](https://github.com/netflix/pollyjs/issues/165)) ([7200255](https://github.com/netflix/pollyjs/commit/7200255))
* **ember:** Remove Node 6 from supported versions ([#169](https://github.com/netflix/pollyjs/issues/169)) ([07b2b4e](https://github.com/netflix/pollyjs/commit/07b2b4e))
* **persister:** Only persist post data if a request has a body ([#171](https://github.com/netflix/pollyjs/issues/171)) ([f62d318](https://github.com/netflix/pollyjs/commit/f62d318))


### chore

* Remove support for Node 6 ([#167](https://github.com/netflix/pollyjs/issues/167)) ([a08a8cf](https://github.com/netflix/pollyjs/commit/a08a8cf))


### Features

* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/commit/5b07b26))
* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/commit/12c8601))


### BREAKING CHANGES

* The node-http adapter no longer accepts the `transports` option
* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).
* Polly will no longer actively support Node 6
* Changes to the base adapter implementation and external facing API





## [1.4.2](https://github.com/netflix/pollyjs/compare/v1.4.1...v1.4.2) (2019-01-16)


### Bug Fixes

* **adapter-node-http:** Fix unhandled rejection if connection fails ([#160](https://github.com/netflix/pollyjs/issues/160)) ([12fcfa7](https://github.com/netflix/pollyjs/commit/12fcfa7))
* **adapter-node-http:** Pause socket on original request ([#162](https://github.com/netflix/pollyjs/issues/162)) ([8f0c56c](https://github.com/netflix/pollyjs/commit/8f0c56c))


### Features

* Lint other filetypes with prettier ([#152](https://github.com/netflix/pollyjs/issues/152)) ([78d1af8](https://github.com/netflix/pollyjs/commit/78d1af8))





## [1.4.1](https://github.com/netflix/pollyjs/compare/v1.4.0...v1.4.1) (2018-12-13)


### Bug Fixes

* **utils:** Support arrays & nested objects in query params ([#148](https://github.com/netflix/pollyjs/issues/148)) ([7e846b0](https://github.com/netflix/pollyjs/commit/7e846b0))





# [1.4.0](https://github.com/netflix/pollyjs/compare/v1.3.2...v1.4.0) (2018-12-07)


### Bug Fixes

* **adapter-fetch:** Deprecate usage in Node in favor of node-http ([#146](https://github.com/netflix/pollyjs/issues/146)) ([001ccdd](https://github.com/netflix/pollyjs/commit/001ccdd))


### Features

* Node HTTP Adapter ([#128](https://github.com/netflix/pollyjs/issues/128)) ([fa059a4](https://github.com/netflix/pollyjs/commit/fa059a4))





## [1.3.2](https://github.com/netflix/pollyjs/compare/v1.3.1...v1.3.2) (2018-11-29)

**Note:** Version bump only for package pollyjs





## [1.3.1](https://github.com/netflix/pollyjs/compare/v1.2.0...v1.3.1) (2018-11-28)


### Bug Fixes

* Support URL objects ([#139](https://github.com/netflix/pollyjs/issues/139)) ([cf0d755](https://github.com/netflix/pollyjs/commit/cf0d755))
* **core:** Handle trailing slashes when generating route names ([#142](https://github.com/netflix/pollyjs/issues/142)) ([19147f7](https://github.com/netflix/pollyjs/commit/19147f7))
* **core:** Ignore `context` options from being deep merged ([#144](https://github.com/netflix/pollyjs/issues/144)) ([2123d83](https://github.com/netflix/pollyjs/commit/2123d83))
* **core:** Support multiple handlers for same paths ([#141](https://github.com/netflix/pollyjs/issues/141)) ([79e04b8](https://github.com/netflix/pollyjs/commit/79e04b8))


### Features

* **core:** Support custom functions in matchRequestsBy config options ([#138](https://github.com/netflix/pollyjs/issues/138)) ([626a84c](https://github.com/netflix/pollyjs/commit/626a84c))
* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/issues/140)) ([548002c](https://github.com/netflix/pollyjs/commit/548002c))





      <a name="1.2.0"></a>
# 1.2.0 (2018-09-16)


### Bug Fixes

* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/commit/53ad433))
* Changes self to global, rollup-plugin-node-globals makes isomorphic ([#54](https://github.com/netflix/pollyjs/issues/54)) ([3811e9d](https://github.com/netflix/pollyjs/commit/3811e9d))
* **core:** Freeze request after emitting afterResponse. ([66a2b64](https://github.com/netflix/pollyjs/commit/66a2b64))
* Allow 204 responses without a body ([#101](https://github.com/netflix/pollyjs/issues/101)) ([20b4125](https://github.com/netflix/pollyjs/commit/20b4125))
* Browser (UMD) build now bundles corejs ([#106](https://github.com/netflix/pollyjs/issues/106)) ([ec62fc0](https://github.com/netflix/pollyjs/commit/ec62fc0))
* Bumping core within Ember ([af4faa1](https://github.com/netflix/pollyjs/commit/af4faa1))
* Config expiresIn can contain periods. i.e, 1.5 weeks ([e9c7aaa](https://github.com/netflix/pollyjs/commit/e9c7aaa))
* Correctly normalize relative URLs ([b9b23cd](https://github.com/netflix/pollyjs/commit/b9b23cd))
* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/commit/19fee5a))
* Do not display node server listening banner in quiet mode ([1be57a7](https://github.com/netflix/pollyjs/commit/1be57a7))
* Ensure polly's middleware goes before ember-cli's ([#36](https://github.com/netflix/pollyjs/issues/36)) ([43db361](https://github.com/netflix/pollyjs/commit/43db361))
* Improve support for relative URLs ([#78](https://github.com/netflix/pollyjs/issues/78)) ([2c0083e](https://github.com/netflix/pollyjs/commit/2c0083e)), closes [#76](https://github.com/netflix/pollyjs/issues/76)
* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/commit/79cdd96))
* Proxy route.params onto the request instead of mutating req ([5bcd4f9](https://github.com/netflix/pollyjs/commit/5bcd4f9))
* Puppeteer 1.7.0 support ([#100](https://github.com/netflix/pollyjs/issues/100)) ([e208b38](https://github.com/netflix/pollyjs/commit/e208b38))
* Puppeteer CORS request matching ([#110](https://github.com/netflix/pollyjs/issues/110)) ([7831115](https://github.com/netflix/pollyjs/commit/7831115))
* Rest server on Windows ([be5c473](https://github.com/netflix/pollyjs/commit/be5c473))
* **core:** Set `url` on the fetch Response object ([#44](https://github.com/netflix/pollyjs/issues/44)) ([f5980cf](https://github.com/netflix/pollyjs/commit/f5980cf)), closes [#43](https://github.com/netflix/pollyjs/issues/43)
* **ember:** Fix auto-register and add tests to cover ([24c15bd](https://github.com/netflix/pollyjs/commit/24c15bd))
* **persister:** Handle concurrent find requests ([#88](https://github.com/netflix/pollyjs/issues/88)) ([0e02414](https://github.com/netflix/pollyjs/commit/0e02414))


### Features

* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/commit/4ebacb8))
* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/commit/0a3d591))
* Cleanup event handler logic + rename some event names ([78dbb5d](https://github.com/netflix/pollyjs/commit/78dbb5d))
* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/issues/45)) ([e622640](https://github.com/netflix/pollyjs/commit/e622640))
* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/commit/8bb313c))
* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/commit/82ebd09))
* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/commit/164dbac))
* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/commit/29ed8e1))
* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/commit/d4be431))
* Move more response methods to shared base class ([#74](https://github.com/netflix/pollyjs/issues/74)) ([4f845e5](https://github.com/netflix/pollyjs/commit/4f845e5))
* Node File System Persister ([#61](https://github.com/netflix/pollyjs/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/commit/0a0eeca))
* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/commit/0b47838))
* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/commit/f902c6d))
* Use status code 204 in place of 404. ([#5](https://github.com/netflix/pollyjs/issues/5)) ([930c492](https://github.com/netflix/pollyjs/commit/930c492))
* **core:** Add `json` property to `Request` ([bb8e1cb](https://github.com/netflix/pollyjs/commit/bb8e1cb)), closes [#7](https://github.com/netflix/pollyjs/issues/7)
* **core:** Default `Response` status code to 200 ([f42a281](https://github.com/netflix/pollyjs/commit/f42a281)), closes [#6](https://github.com/netflix/pollyjs/issues/6)
* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/commit/a3113b7))
* **core:** Normalize headers by lower-casing all keys ([#42](https://github.com/netflix/pollyjs/issues/42)) ([02a4767](https://github.com/netflix/pollyjs/commit/02a4767))
* **core:** Server level configuration ([#80](https://github.com/netflix/pollyjs/issues/80)) ([0f32d9b](https://github.com/netflix/pollyjs/commit/0f32d9b))
* **node-server:** Add cors support to express server to pass-through all requests ([223ce4e](https://github.com/netflix/pollyjs/commit/223ce4e))
* **persister:** Add `keepUnusedRequests` config option ([#108](https://github.com/netflix/pollyjs/issues/108)) ([3f5f5b2](https://github.com/netflix/pollyjs/commit/3f5f5b2))
* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/commit/a04d7a7))


### Reverts

* "Update commitlint.config.js" ([65e6996](https://github.com/netflix/pollyjs/commit/65e6996))
* Add `json` property to `Request` ([4ea50e8](https://github.com/netflix/pollyjs/commit/4ea50e8))
* Revert "Update commitlint.config.js" ([6624cb5](https://github.com/netflix/pollyjs/commit/6624cb5))
* Revert Use docsify GA plugin ([35ace6f](https://github.com/netflix/pollyjs/commit/35ace6f))
* Use docsify GA plugin ([cf5f1c5](https://github.com/netflix/pollyjs/commit/cf5f1c5))


### BREAKING CHANGES

* __Adapters__

```js
import { XHRAdapter, FetchAdapter } from '@pollyjs/core';

// Register the xhr adapter so its accessible by all future polly instances
Polly.register(XHRAdapter);

polly.configure({
adapters: ['xhr', FetchAdapter]
});
```

__Persister__

```js
import { LocalStoragePersister, RESTPersister } from '@pollyjs/core';

// Register the local-storage persister so its accessible by all future polly instances
Polly.register(LocalStoragePersister);

polly.configure({
persister: 'local-storage'
});

polly.configure({
persister: RESTPersister
});
```
* Recordings now produce HAR compliant json. Please delete existing recordings.
* **core:** With this change, request ids will resolve to a different hash meaning that users will have to rerecord.
* Relative URLs will have different hashes and will
require to re-record.




      # Changelog


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

## Getting Started

Install required global dependencies:

```bash
npm install -g yarn
```

Check out the code and go into the pollyjs directory:

```bash
git clone https://github.com/netflix/pollyjs.git
cd pollyjs
```

Install the dependencies and bootstrap the monorepo:

```bash
yarn
```

The code for individual packages of this monorepo are in `packages/@pollyjs/*`.
Within any of the packages in this monorepo you'll generally use the npm
package scripts to manage the project, E.g. `yarn run test` or
`yarn run lint`. Run `yarn run` for a list of available commands.

## Running Tests

### Full Suite

To run the full test suite, from the root directory run:

```bash
yarn test
```

This will perform a full bootstrap, clean and build on all of the sub-packages
and test suite, stand up the node server, run the test suite and then terminate.

### Running only changed tests

While developing, it may become cumbersome to run the entire suite after each change.
In one terminal tab, run the following:

```bash
yarn watch
```

This will build all of the sub-packages and test suite, watch for any changes, and
perform incremental builds when the suite or packages are changed.

Wait until the build settles (i.e. build output stops scrolling). Then, in another tab:

```bash
yarn test:watch
```

This will launch an interactive test runner (`testem`), which will automatically detect
and re-run changed tests. To manually re-run the suite, hit `enter`. To exit, hit `q` and
then `ctrl-c` your watch process. For more information, look at the
[testem docs](https://github.com/testem/testem).

## Running Node Tests with Chrome Inspector

To run the node test suite with node inspector support, run from the root directory:

```bash
yarn test:ci -l Node:debug
```

Next, attach Chrome to the running process by visiting [chrome://inspect/#devices](chrome://inspect/#devices)

## Running Docs

All the documentation can be found in the root level `docs` directory. Running
the following command will stand up the docs server which will watch for
changes.

```bash
yarn docs:serve
```

## Conventional Commits

Lerna depends on the use of the [Conventional Commits Specification](https://conventionalcommits.org/)
to determine the version bump and generate CHANGELOG.md files. Make sure your
commits and the title of your PRs follow the spec. A pre-commit hook and CI test
have been added to further enforce this requirement.

## Tips for Getting Your Pull Request Accepted

1. Make sure all new features are tested and the tests pass.
2. Bug fixes must include a test case demonstrating the error that it fixes.
3. Open an issue first and seek advice for your change before submitting
   a pull request. Large features which have never been discussed are
   unlikely to be accepted. **You have been warned.**


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "{}"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2018 Netflix Inc and @pollyjs contributors

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: OSSMETADATA
================================================
osslifecycle=active


================================================
FILE: README.md
================================================
<p align="center">
  <img alt="Polly.JS" width="400px" src="https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png" />
</p>
<h2 align="center">Record, Replay, and Stub HTTP Interactions</h2>

[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)
[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)

Polly.JS is a standalone, framework-agnostic JavaScript library that enables recording, replaying, and stubbing of HTTP interactions. By tapping into multiple request APIs across both Node & the browser, Polly.JS is able to mock requests and responses with little to no configuration while giving you the ability to take full control of each request with a simple, powerful, and intuitive API.

> Interested in contributing or just seeing Polly in action? Head over to [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to spin up the project!

## Why Polly?

Keeping fixtures and factories in parity with your APIs can be a time consuming process.
Polly alleviates this process by recording and maintaining actual server responses while also staying flexible.

- Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Use Polly's client-side server to modify or intercept requests and responses to simulate different application states (e.g. loading, error, etc.).

## Features

- 🚀 Node & Browser Support
- ⚡️️ Simple, Powerful, & Intuitive API
- 💎 First Class Mocha & QUnit Test Helpers
- 🔥 Intercept, Pass-Through, and Attach Events
- 📼 Record to Disk or Local Storage
- ⏱ Slow Down or Speed Up Time

## Getting Started

Check out the [Quick Start](https://netflix.github.io/pollyjs/#/quick-start) documentation to get started.

## Usage

Let's take a look at what an example test case would look like using Polly.

```js
import { Polly } from '@pollyjs/core';
import XHRAdapter from '@pollyjs/adapter-xhr';
import FetchAdapter from '@pollyjs/adapter-fetch';
import RESTPersister from '@pollyjs/persister-rest';

/*
  Register the adapters and persisters we want to use. This way all future
  polly instances can access them by name.
*/
Polly.register(XHRAdapter);
Polly.register(FetchAdapter);
Polly.register(RESTPersister);

describe('Netflix Homepage', function () {
  it('should be able to sign in', async function () {
    /*
      Create a new polly instance.

      Connect Polly to both fetch and XHR browser APIs. By default, it will
      record any requests that it hasn't yet seen while replaying ones it
      has already recorded.
    */
    const polly = new Polly('Sign In', {
      adapters: ['xhr', 'fetch'],
      persister: 'rest'
    });
    const { server } = polly;

    /* Intercept all Google Analytic requests and respond with a 200 */
    server
      .get('/google-analytics/*path')
      .intercept((req, res) => res.sendStatus(200));

    /* Pass-through all GET requests to /coverage */
    server.get('/coverage').passthrough();

    /* start: pseudo test code */
    await visit('/login');
    await fillIn('email', 'polly@netflix.com');
    await fillIn('password', '@pollyjs');
    await submit();
    /* end: pseudo test code */

    expect(location.pathname).to.equal('/browse');

    /*
      Calling `stop` will persist requests as well as disconnect from any
      connected browser APIs (e.g. fetch or XHR).
    */
    await polly.stop();
  });
});
```

The above test case would generate the following [HAR](http://www.softwareishard.com/blog/har-12-spec/)
file which Polly will use to replay the sign-in response when the test is rerun:

```json
{
  "log": {
    "_recordingName": "Sign In",
    "browser": {
      "name": "Chrome",
      "version": "67.0"
    },
    "creator": {
      "name": "Polly.JS",
      "version": "0.5.0",
      "comment": "persister:rest"
    },
    "entries": [
      {
        "_id": "06f06e6d125cbb80896c41786f9a696a",
        "_order": 0,
        "cache": {},
        "request": {
          "bodySize": 51,
          "cookies": [],
          "headers": [
            {
              "name": "content-type",
              "value": "application/json; charset=utf-8"
            }
          ],
          "headersSize": 97,
          "httpVersion": "HTTP/1.1",
          "method": "POST",
          "postData": {
            "mimeType": "application/json; charset=utf-8",
            "text": "{\"email\":\"polly@netflix.com\",\"password\":\"@pollyjs\"}"
          },
          "queryString": [],
          "url": "https://netflix.com/api/v1/login"
        },
        "response": {
          "bodySize": 0,
          "content": {
            "mimeType": "text/plain; charset=utf-8",
            "size": 0
          },
          "cookies": [],
          "headers": [],
          "headersSize": 0,
          "httpVersion": "HTTP/1.1",
          "redirectURL": "",
          "status": 200,
          "statusText": "OK"
        },
        "startedDateTime": "2018-06-29T17:31:55.348Z",
        "time": 11,
        "timings": {
          "blocked": -1,
          "connect": -1,
          "dns": -1,
          "receive": 0,
          "send": 0,
          "ssl": -1,
          "wait": 11
        }
      }
    ],
    "pages": [],
    "version": "1.2"
  }
}
```

## Prior Art

The "Client Server" API of Polly is heavily influenced by the very popular mock server library [pretender](https://github.com/pretenderjs/pretender). Pretender supports XHR and Fetch stubbing and is a great lightweight alternative to Polly if your project does not require persisting capabilities or Node adapters.

Thank you to all contributors especially the maintainers: [trek](https://github.com/trek), [stefanpenner](https://github.com/stefanpenner), and [xg-wang](https://github.com/xg-wang).

## Contributors

[//]: contributor-faces

<a href="https://github.com/offirgolan"><img src="https://avatars.githubusercontent.com/u/575938?v=4" title="offirgolan" width="80" height="80"></a>
<a href="https://github.com/jasonmit"><img src="https://avatars.githubusercontent.com/u/3108309?v=4" title="jasonmit" width="80" height="80"></a>
<a href="https://github.com/cibernox"><img src="https://avatars.githubusercontent.com/u/265339?v=4" title="cibernox" width="80" height="80"></a>
<a href="https://github.com/DenrizSusam"><img src="https://avatars.githubusercontent.com/u/39295979?v=4" title="DenrizSusam" width="80" height="80"></a>
<a href="https://github.com/dustinsoftware"><img src="https://avatars.githubusercontent.com/u/942358?v=4" title="dustinsoftware" width="80" height="80"></a>
<a href="https://github.com/silverchen"><img src="https://avatars.githubusercontent.com/u/6683103?v=4" title="silverchen" width="80" height="80"></a>
<a href="https://github.com/tombh"><img src="https://avatars.githubusercontent.com/u/160835?v=4" title="tombh" width="80" height="80"></a>
<a href="https://github.com/zkwentz"><img src="https://avatars.githubusercontent.com/u/4832?v=4" title="zkwentz" width="80" height="80"></a>
<a href="https://github.com/agraves"><img src="https://avatars.githubusercontent.com/u/46964?v=4" title="agraves" width="80" height="80"></a>
<a href="https://github.com/brandon-leapyear"><img src="https://avatars.githubusercontent.com/u/27799541?v=4" title="brandon-leapyear" width="80" height="80"></a>
<a href="https://github.com/swashcap"><img src="https://avatars.githubusercontent.com/u/1858316?v=4" title="swashcap" width="80" height="80"></a>
<a href="https://github.com/justsml"><img src="https://avatars.githubusercontent.com/u/397632?v=4" title="justsml" width="80" height="80"></a>
<a href="https://github.com/DanielRuf"><img src="https://avatars.githubusercontent.com/u/827205?v=4" title="DanielRuf" width="80" height="80"></a>
<a href="https://github.com/dciccale"><img src="https://avatars.githubusercontent.com/u/539546?v=4" title="dciccale" width="80" height="80"></a>
<a href="https://github.com/ericclemmons"><img src="https://avatars.githubusercontent.com/u/15182?v=4" title="ericclemmons" width="80" height="80"></a>
<a href="https://github.com/jamesgeorge007"><img src="https://avatars.githubusercontent.com/u/25279263?v=4" title="jamesgeorge007" width="80" height="80"></a>
<a href="https://github.com/woodenconsulting"><img src="https://avatars.githubusercontent.com/u/4163029?v=4" title="woodenconsulting" width="80" height="80"></a>
<a href="https://github.com/feinoujc"><img src="https://avatars.githubusercontent.com/u/1733707?v=4" title="feinoujc" width="80" height="80"></a>
<a href="https://github.com/josex2r"><img src="https://avatars.githubusercontent.com/u/3719730?v=4" title="josex2r" width="80" height="80"></a>
<a href="https://github.com/jomaxx"><img src="https://avatars.githubusercontent.com/u/2747424?v=4" title="jomaxx" width="80" height="80"></a>
<a href="https://github.com/karlhorky"><img src="https://avatars.githubusercontent.com/u/1935696?v=4" title="karlhorky" width="80" height="80"></a>
<a href="https://github.com/kennethlarsen"><img src="https://avatars.githubusercontent.com/u/1408595?v=4" title="kennethlarsen" width="80" height="80"></a>
<a href="https://github.com/poteto"><img src="https://avatars.githubusercontent.com/u/1390709?v=4" title="poteto" width="80" height="80"></a>
<a href="https://github.com/fastfrwrd"><img src="https://avatars.githubusercontent.com/u/231133?v=4" title="fastfrwrd" width="80" height="80"></a>
<a href="https://github.com/rwd"><img src="https://avatars.githubusercontent.com/u/218337?v=4" title="rwd" width="80" height="80"></a>
<a href="https://github.com/rmachielse"><img src="https://avatars.githubusercontent.com/u/2470404?v=4" title="rmachielse" width="80" height="80"></a>
<a href="https://github.com/ROpdebee"><img src="https://avatars.githubusercontent.com/u/15186467?v=4" title="ROpdebee" width="80" height="80"></a>
<a href="https://github.com/gribnoysup"><img src="https://avatars.githubusercontent.com/u/5036933?v=4" title="gribnoysup" width="80" height="80"></a>
<a href="https://github.com/shriyash"><img src="https://avatars.githubusercontent.com/u/4494915?v=4" title="shriyash" width="80" height="80"></a>

[//]: contributor-faces

## License

Copyright (c) 2018 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


================================================
FILE: docs/.nojekyll
================================================


================================================
FILE: docs/_coverpage.md
================================================
<div class="netflix-logo">
  <div class="logo"></div>
</div>

![logo](assets/images/wordmark-logo-alt.png)

> Record, replay, and stub HTTP interactions.

- 🚀 Node & Browser Support
- ⚡️️ Simple, Powerful, & Intuitive API
- 💎 First Class Mocha & QUnit Test Helpers
- 🔥 Intercept, Pass-Through, and Attach Events
- 📼 Record to Disk or Local Storage
- ⏱ Slow Down or Speed Up Time

<div class="buttons">
  <a href="https://github.com/Netflix/pollyjs/" target="_blank"><span>GitHub</span></a>
  <a href="#/README"><span>Get Started</span></a>
</div>

![color](#ffffff)


================================================
FILE: docs/_sidebar.md
================================================
- Getting Started

  - [Overview](README.md)
  - [Quick Start](quick-start.md)
  - [Examples](examples.md)

- Test Frameworks

  - [Mocha](test-frameworks/mocha.md)
  - [QUnit](test-frameworks/qunit.md)
  - [Jest & Jasmine](test-frameworks/jest-jasmine.md)

- Frameworks

  - [Ember CLI](frameworks/ember-cli.md)

- Adapters

  - [Fetch](adapters/fetch.md)
  - [Node HTTP](adapters/node-http.md)
  - [Playwright](adapters/playwright.md)
  - [Puppeteer](adapters/puppeteer.md)
  - [XHR](adapters/xhr.md)
  - [Custom](adapters/custom.md)

- Persisters

  - [File System](persisters/fs.md)
  - [Local Storage](persisters/local-storage.md)
  - [REST](persisters/rest.md)
  - [Custom](persisters/custom.md)

- Client Server

  - [Overview](server/overview.md)
  - [API](server/api.md)
  - [Events & Middleware](server/events-and-middleware.md)
  - [Route Handler](server/route-handler.md)
  - [Request](server/request.md)
  - [Response](server/response.md)
  - [Event](server/event.md)

- Node Server

  - [Overview](node-server/overview.md)
  - [Express Integrations](node-server/express-integrations.md)

- CLI

  - [Overview](cli/overview.md)
  - [Commands](cli/commands.md)

- Reference

  - [API](api.md)
  - [Configuration](configuration.md)

- [Contributing](CONTRIBUTING.md)


================================================
FILE: docs/adapters/custom.md
================================================
# Custom Adapter

If you need to create your own adapter or modify an pre-existing one, you've come
to the right page!

## Creating a Custom Adapter

The `@pollyjs/adapter` package provides an extendable base adapter class that
contains core logic dependent on by the [Fetch](adapters/fetch)
& [XHR](adapters/xhr) adapters.

### Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter -D
```

### Usage

```js
import Adapter from '@pollyjs/adapter';

class CustomAdapter extends Adapter {
  static get id() {
    return 'custom';
  }

  onConnect() {
    /* Do something when the adapter is connect to */
  }

  onDisconnect() {
    /* Do something when the adapter is disconnected from */
  }

  async onFetchResponse(pollyRequest) {
    /* Do something when the adapter is connect to */
  }

  /* optional */
  async onRespond(pollyRequest) {
    const { statusCode, body, headers } = pollyRequest.response;
    /* Deliver the response to the user */
  }
}
```

The `Adapter` class provides the `handleRequest()` method which can be
called from `onConnect`. It accepts request parameters and returns a
PollyRequest object with a `response` property.

The `onFetchResponse` method takes a PollyRequest object, makes a real HTTP
request and returns the response as a `{ statusCode, headers, body }` object,
where `body` is a string.

The `onRespond()` method makes sure that the response has been delivered
to the user. `pollyjs.flush()` will wait for all `onResponds()` calls to
finish. You can omit the implementation of this method if no asynchronous
delivery is required.

### Simple Fetch adapter example

The following is a simple example of implementing an adapter for `fetch`. For
full examples, please refer to the source code for the
[Fetch](https://github.com/Netflix/pollyjs/blob/master/packages/@pollyjs/adapter-fetch/src/index.js)
& [XHR](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/adapter-xhr/src/index.js)
adapters.

```js
class FetchAdapter extends Adapter {
  static get id() {
    return 'fetch';
  }

  onConnect() {
    this.originalFetch = window.fetch;

    window.fetch = async (url, options = {}) => {
      const { response } = await this.handleRequest({
        url,
        method: options.method,
        headers: options.headers,
        body: options.body
      });

      return new Response(response.body, {
        status: response.statusCode,
        statusText: response.statusText,
        headers: response.headers
      });
    };
  }

  onDisconnect() {
    window.fetch = this.originalFetch;
  }

  async onFetchResponse(pollyRequest) {
    const response = await this.originalFetch([
      pollyRequest.url,
      {
        method: pollyRequest.method,
        headers: pollyRequest.headers,
        body: pollyRequest.body
      }
    ]);

    return {
      statusCode: response.status,
      headers: serializeHeaders(response.headers),
      body: await response.text()
    };
  }
}
```

## Extending from an Existing Adapter

The `@pollyjs/core` package exports the `XHRAdapter` and `FetchAdapter` classes,
allowing you to modify them as needed.

```js
import XHRAdapter from '@pollyjs/adapter-xhr';
import FetchAdapter from '@pollyjs/adapter-fetch';

class CustomXHRAdapter extends XHRAdapter {}
class CustomFetchAdapter extends FetchAdapter {}
```

## Registering & Connecting to a Custom Adapter

You can register and connect to a custom adapter by passing an array to the `adapters`
config where the first element is the name of your adapter and the second is the
adapter class.

```js
// Register and connect to a custom adapter:
new Polly('Custom Adapter', {
  adapters: [MyCustomAdapterClass]
});

// Register and connect to a custom adapter via .configure():
const polly = new Polly('Custom Adapter');

polly.configure({
  adapters: [MyCustomAdapterClass]
});
```


================================================
FILE: docs/adapters/fetch.md
================================================
# Fetch Adapter

The fetch adapter wraps the global fetch method for seamless
recording and replaying of requests.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter-fetch -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter-fetch -D
```

## Usage

Use the [configure](api#configure), [connectTo](api#connectto), and
[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the
adapter.

```js
import { Polly } from '@pollyjs/core';
import FetchAdapter from '@pollyjs/adapter-fetch';

// Register the fetch adapter so its accessible by all future polly instances
Polly.register(FetchAdapter);

const polly = new Polly('<Recording Name>', {
  adapters: ['fetch']
});

// Disconnect using the `configure` API
polly.configure({ adapters: [] });

// Reconnect using the `connectTo` API
polly.connectTo('fetch');

// Disconnect using the `disconnectFrom` API
polly.disconnectFrom('fetch');
```

## Options

### context

_Type_: `Object`
_Default_: `global|self|window`

The context object which contains the fetch API. Typically this is `window` or `self` in the browser and `global` in node.

**Example**

```js
polly.configure({
  adapters: ['fetch'],
  adapterOptions: {
    fetch: {
      context: window
    }
  }
});
```


================================================
FILE: docs/adapters/node-http.md
================================================
# Node HTTP Adapter

The node-http adapter provides a low level nodejs http request adapter that uses [nock](https://github.com/nock/nock) to patch the [http](https://nodejs.org/api/http.html) and [https](https://nodejs.org/api/https.html) modules in nodejs for seamless recording and replaying of requests.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter-node-http -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter-node-http -D
```

## Usage

Use the [configure](api#configure), [connectTo](api#connectto), and
[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the
adapter.

```js
import { Polly } from '@pollyjs/core';
import NodeHttpAdapter from '@pollyjs/adapter-node-http';

// Register the node http adapter so its accessible by all future polly instances
Polly.register(NodeHttpAdapter);

const polly = new Polly('<Recording Name>', {
  adapters: ['node-http']
});

// Disconnect using the `configure` API
polly.configure({ adapters: [] });

// Reconnect using the `connectTo` API
polly.connectTo('node-http');

// Disconnect using the `disconnectFrom` API
polly.disconnectFrom('node-http');
```


================================================
FILE: docs/adapters/playwright.md
================================================
# Playwright Adapter

The 3rd party [Playwright](https://playwright.dev/) adapter is provided by [@gribnoysup](https://github.com/redabacha). Please follow the readme below for installation and usage instructions.

[README.md](https://raw.githubusercontent.com/redabacha/polly-adapter-playwright/master/README.md ':include :type=markdown')


================================================
FILE: docs/adapters/puppeteer.md
================================================
# Puppeteer Adapter

The [Puppeteer](https://pptr.dev/) adapter attaches events to a given
[page](https://pptr.dev/#?product=Puppeteer&show=api-class-page) instance allowing
you to get the full power of Polly and Puppeteer.

## Installation

?> **NOTE** If you're using Puppeteer 1.7 or 1.8, you'll experience issues using passthrough requests. Please upgrade to the latest version of Puppeteer or use a version prior to 1.7.

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter-puppeteer -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter-puppeteer -D
```

## Usage

Use the [configure](api#configure), [connectTo](api#connectto), and
[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the
adapter.

```js
import { Polly } from '@pollyjs/core';
import PuppeteerAdapter from '@pollyjs/adapter-puppeteer';

// Register the puppeteer adapter so its accessible by all future polly instances
Polly.register(PuppeteerAdapter);

const browser = await puppeteer.launch();
const page = await this.browser.newPage();

await page.setRequestInterception(true);

const polly = new Polly('<Recording Name>', {
  adapters: ['puppeteer'],
  adapterOptions: {
    puppeteer: { page }
  }
});

// Disconnect using the `configure` API
polly.configure({ adapters: [] });

// Reconnect using the `connectTo` API
polly.connectTo('puppeteer');

// Disconnect using the `disconnectFrom` API
polly.disconnectFrom('puppeteer');
```

## Options

### page

_Type_: [Page](https://pptr.dev/#?product=Puppeteer&show=api-class-page)
_Default_: `null`

!> **NOTE:** This is a _required_ option.

The Puppeteer page instance Polly should attach events to in order to intercept
requests.

**Example**

```js
const browser = await puppeteer.launch();
const page = await this.browser.newPage();

await page.setRequestInterception(true);

polly.configure({
  adapters: ['puppeteer'],
  adapterOptions: {
    puppeteer: { page }
  }
});

await page.goto('http://netflix.com');
```

### requestResourceTypes

_Type_: `Array`
_Default_: `['xhr', 'fetch']`

The request [resource types](https://pptr.dev/#?product=Puppeteer&show=api-requestresourcetype)
to intercept.

**Example**

```js
polly.configure({
  adapterOptions: {
    puppeteer {
      requestResourceTypes: ['xhr']
    }
  }
});
```


================================================
FILE: docs/adapters/xhr.md
================================================
# XHR Adapter

The XHR adapter uses Sinon's [Nise](https://github.com/sinonjs/nise) library
to fake the global `XMLHttpRequest` object while wrapping the native one to allow
for seamless recording and replaying of requests.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter-xhr -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter-xhr -D
```

## Usage

Use the [configure](api#configure), [connectTo](api#connectto), and
[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the
adapter.

```js
import { Polly } from '@pollyjs/core';
import XHRAdapter from '@pollyjs/adapter-xhr';

// Register the xhr adapter so its accessible by all future polly instances
Polly.register(XHRAdapter);

const polly = new Polly('<Recording Name>', {
  adapters: ['xhr']
});

// Disconnect using the `configure` API
polly.configure({ adapters: [] });

// Reconnect using the `connectTo` API
polly.connectTo('xhr');

// Disconnect using the `disconnectFrom` API
polly.disconnectFrom('xhr');
```

## Options

### context

_Type_: `Object`
_Default_: `global|self|window`

The context object which contains the XMLHttpRequest object. Typically this is `window` or `self` in the browser and `global` in node.

**Example**

```js
polly.configure({
  adapters: ['xhr'],
  adapterOptions: {
    xhr: {
      context: window
    }
  }
});
```


================================================
FILE: docs/api.md
================================================
# API

## Constructor

Create a new Polly instance.

| Param         | Type     | Description                                                               |
| ------------- | -------- | ------------------------------------------------------------------------- |
| recordingName | `String` | Name of the [recording](api#recordingName) to store the recordings under. |
| config        | `Object` | [Configuration](configuration) object                                     |
| **Returns**   | `Polly`  | &nbsp;                                                                    |

**Example**

```js
new Polly('<Recording Name>', {
  /* ... */
});
```

## Events

### create

Emitted when a Polly instance gets created.

!> This is a synchronous event.

**Example**

```js
const listener = polly => {
  /* Do Something */
};

Polly.on('create', listener);
Polly.off('create', listener);
Polly.once('create', polly => {
  /* Do Something Once */
});
```

### stop

Emitted when a Polly instance has successfully stopped.

**Example**

```js
const listener = polly => {
  /* Do Something */
};

Polly.on('stop', listener);
Polly.off('stop', listener);
Polly.once('stop', polly => {
  /* Do Something Once */
});
```

## Properties

### recordingName

_Type_: `String`
_Default_: `null`

The recording name the recordings will be stored under. The provided name is
sanitized as well as postfixed with a GUID.

**Example**

```js
new Polly('Wants a Cracker', {
  /* ... */
});
```

Will save recordings to the following file:

```text
recordings
  └── Wants-a-Cracker_1234
      └── recording.json
```

**Example**

?> A recording can also have slashes to better organize recordings.

```js
new Polly('Wants a Cracker/Cheddar');
```

Will save recordings to the following file:

```text
recordings
  └── Wants-a-Cracker_1234
      └── Cheddar_5678
          └── recording.json
```

### mode

_Type_: `String`
_Default_: `'replay'`

The current [mode](configuration#mode) polly is in.

**Example**

```js
const polly = new Polly();

polly.mode; // → 'replay'
polly.record();
polly.mode; // → 'record'
```

### persister

_Type_: `Persister`
_Default_: `null`

The persister used to find and save recordings.

### server

_Type_: `Server`
_Default_: `Server`

Every polly instance has a reference to a [client-side server](server/overview) which you can leverage
to gain full control of all HTTP interactions as well as dictate how the Polly instance
should handle them.

```js
const { server } = polly;

server.get('/movies').passthrough();
server.get('/series').intercept((req, res) => res.sendStatus(200));
```

## Methods

### configure

Configure polly with the given configuration object.

| Param  | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| config | `Object` | [Configuration](configuration) object |

**Example**

```js
polly.configure({ recordIfMissing: false });
```

### record

Puts polly in recording mode. All requests going forward will
be sent to the server and their responses will be recorded.

**Example**

```js
polly.record();
```

### replay

Puts polly in replay mode. All requests going forward will be
played back from a saved recording.

**Example**

```js
polly.replay();
```

### passthrough

Puts polly in pass-through mode. All requests going forward will pass-through
directly to the server without being recorded or replayed.

**Example**

```js
polly.passthrough();
```

### pause

Disconnects the polly instance from all connected adapters. This ensures that
no requests will be handled by the polly instance until calling [play](api#play)
or manually connecting to a new adapter via [connectTo](api#connectTo). The
previously connected adapters will be saved and can be restored by
calling [play](api#play).

?> If using the [Puppeteer Adapter](adapters/puppeteer), you'll need to also
disable request interception via `await page.setRequestInterception(false)`.

**Example**

```js
await fetch('/api/not-a-secret');
polly.pause();
// This and all subsequent requests will no longer be handled by polly
await fetch('/api/secret');
```

### play

Reconnects to the adapters that were disconnected when [pause](api#pause)
was called.

?> If using the [Puppeteer Adapter](adapters/puppeteer), you'll need to also
enable request interception via `await page.setRequestInterception(true)`.

**Example**

```js
await fetch('/api/not-a-secret');
polly.pause();
// This and all subsequent requests will no longer be handled by polly
await fetch('/api/secret');
polly.play();
// This and all subsequent requests will again be handled by polly
await fetch('/api/not-a-secret');
```

### stop

Persist all recordings and disconnect from all adapters.

!> This method is `async` and will resolve once all recordings have
persisted and the instance has successfully torn down.

| Param   | Type      | Description |
| ------- | --------- | ----------- |
| Returns | `Promise` | &nbsp;      |

**Example**

```js
await polly.stop();
```

### connectTo

Connect to an adapter.

| Param | Type              | Description                             |
| ----- | ----------------- | --------------------------------------- |
| name  | `String|Function` | The adapter name of class to connect to |

**Example**

```js
polly.connectTo('xhr');
polly.connectTo(XHRAdapter);
```

### disconnectFrom

Disconnect from an adapter.

| Param | Type              | Description                                  |
| ----- | ----------------- | -------------------------------------------- |
| name  | `String|Function` | The adapter name of class to disconnect from |

**Example**

```js
polly.disconnectFrom('xhr');
polly.disconnectFrom(XHRAdapter);
```

### disconnect

Disconnect from all connected adapters.

**Example**

```js
polly.disconnect();
```

### flush

Returns a Promise that resolves once all requests handled by Polly have resolved.

| Param   | Type      | Description |
| ------- | --------- | ----------- |
| Returns | `Promise` | &nbsp;      |

**Example**

```js
await polly.flush();
```


================================================
FILE: docs/assets/styles.css
================================================
:root {
  --theme-color: #e50914;
  --theme-color-dark: #b20710;

  --text-color-base: #2e2e46;
  --text-color-secondary: #646473;
  --text-color-tertiary: #81818e;
}

body {
  font-size: 100%;
  line-height: 1.5;
  color: var(--text-color-base);
}

* {
  text-decoration: none !important;
}

a {
  transition: all 0.3s linear;
}

.github-corner {
  z-index: 5;
}

/****** Cover Page ******/
section.cover {
  padding-bottom: 112px; /* fixed footer (Netflix) height */
  height: auto;
  min-height: 100vh;
  /**
   * Intended to defeat this inline style on initial boot that flashes when on page load:
   * https://github.com/docsifyjs/docsify/blob/8352a1e489abc2a7b6361fe02d696e1891a031cd/src/core/render/tpl.js#L56-L70
   */
  background: #fff !important;
}

section.cover .cover-main {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin: 0;
  padding: 32px 16px 0;
}

section.cover img {
  width: 400px;
}

section.cover h1 {
  margin: 0.625rem 0 1rem;
}

section.cover blockquote,
section.cover blockquote p {
  margin: 0;
}

section.cover ul {
  font-size: 1.25rem;
  line-height: 2rem;
  display: grid;
  text-align: left;
  grid-column-gap: 16px;
  grid-row-gap: 20px;
  grid-template-columns: repeat(2, 50%);
  list-style: none;
  max-width: unset;
  margin: 1.5em 0;
}

section.cover ul li {
  white-space: nowrap;
}

section.cover.show ~ .sidebar,
section.cover.show ~ .sidebar-toggle {
  display: none;
}

.cover-main .netflix-logo {
  position: fixed;
  display: flex;
  align-items: center;
  background: #ffffff;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 40px;
  z-index: 5;
}

.cover-main .netflix-logo .logo {
  width: 125px;
  height: 32px;
  background: url('images/Netflix_Logo.png');
  background-size: 100%;
  background-repeat: no-repeat;
  background-position: center center;
}

.cover-main .buttons {
  width: 100%;
}

.cover-main .buttons a {
  font-weight: 700;
  position: relative;
  display: inline-block;
  padding: 12px 25px;
  font-size: 14px;
  text-align: center;
  line-height: 18px;
  color: #221f1f;
  background: #fff;
  outline: none;
  border: none;
  background-color: #fff;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  margin: 0 1rem;
  color: var(--theme-color);
  overflow: hidden;
  transition: color 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);
  vertical-align: baseline;
  text-transform: uppercase;
}

.cover-main .buttons a:before,
.cover-main .buttons a:after {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border: 2px solid var(--theme-color);
  box-sizing: border-box;
}

.cover-main .buttons a:after {
  background: var(--theme-color);
  transform: translateX(-101%);
  transition: all 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.cover-main .buttons a:hover {
  color: white;
  box-shadow: 0 5px 16px rgba(229, 9, 20, 0.3);
}

.cover-main .buttons a:hover:after {
  transform: translateX(0);
}

.cover-main .buttons a span {
  position: relative;
  z-index: 1;
}

@media (max-width: 850px) {
  section.cover ul {
    grid-template-columns: 100%;
    padding: 0;
  }

  section.cover ul li {
    text-align: center;
  }
}

@media (max-width: 450px) {
  section.cover ul li {
    white-space: normal;
  }

  .cover-main .buttons a {
    width: 100%;
    margin: 0.2rem 0;
  }
}

/****** Sidebar ******/
.sidebar .app-name-link img {
  height: 150px;
}

.sidebar ul li a {
  font-size: 15px;
}

.sidebar ul li a:hover {
  color: var(--theme-color);
}

.app-sub-sidebar li:before {
  display: none;
}

.sidebar .search .clear-button {
  cursor: pointer;
}

/****** Sidebar Toggle ******/
.sidebar-toggle {
  cursor: pointer;
}

body .sidebar-toggle {
  background: none;
  top: 1.5rem;
  left: calc(300px + 1.5rem);
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  transition: left 0.25s ease-out;
}

body .sidebar-toggle span {
  background-color: var(--theme-color);
  height: 0.2rem;
  width: 1.5rem;
  position: absolute;
  left: 0;
  margin: 0;
  transform-origin: 0;
  border-radius: 1px;
}

body.close .sidebar-toggle {
  transition: left 0.25s ease-out;
  width: 1.5rem;
  height: 1.5rem;
  left: 1.5rem;
}

body.close .sidebar-toggle span {
  transform-origin: center;
}

body .sidebar-toggle span:nth-child(1) {
  top: 0;
}
body .sidebar-toggle span:nth-child(2) {
  top: 0.5rem;
}
body .sidebar-toggle span:nth-child(3) {
  top: 1rem;
}

.sidebar-toggle:hover {
  opacity: 0.8;
}
.sidebar-toggle .sidebar-toggle-button:hover {
  opacity: 1;
}

@media screen and (max-width: 768px) {
  body .sidebar-toggle {
    left: 1rem;
  }

  body.close .sidebar-toggle {
    left: calc(300px + 1.5rem);
  }
}

/****** Markdown General ******/
.markdown-section {
  padding: 30px 30px 40px;
}

.markdown-section a {
  text-decoration: none;
  border-bottom: 0.1rem solid var(--theme-color);
  transition: all 0.3s ease;
}

.markdown-section a:hover {
  border-color: var(--theme-color-dark);
  color: var(--theme-color-dark);
}

.markdown-section a.anchor {
  border: none;
}

/****** Markdown Table ******/
.markdown-section table {
  display: table;
}

.markdown-section table tr {
  border-width: 0.15rem 0;
  border-style: solid;
  border-color: #f1f1f2;
}

.markdown-section table thead tr {
  text-transform: uppercase;
  font-size: 90%;
  border-top: none;
}

.markdown-section table tbody tr:last-of-type {
  border-bottom: none;
}

.markdown-section table tr:nth-child(2n) {
  background-color: transparent;
}

.markdown-section table td,
.markdown-section table th {
  border: none;
  padding: 1.1rem 0.5rem;
  text-align: left;
}

.markdown-section table td p {
  margin: 0;
}

.markdown-section blockquote {
  margin: 1em 0;
}

.markdown-section blockquote > p {
  font-weight: 500;
}

.markdown-section em,
.markdown-section blockquote {
  color: var(--text-color-tertiary);
}

/****** CODE HIGHLIGHTING ******/
.token.string {
  color: #42b983;
}

.token.boolean,
.token.number {
  color: var(--theme-color);
}

.lang-bash .token.function,
.lang-json .token.property {
  color: #e96900;
}

/****** COPY TO CLIPBOARD ******/
.docsify-copy-code-button {
  font-size: 0.7em !important;
}


================================================
FILE: docs/cli/commands.md
================================================
# Commands

As of right now, the Polly CLI only knows one command but expect to see more
in the near future!

## listen

Start up a node server and listen for Polly requests via the
[REST Persister](persisters/rest) to be able to record and replay recordings
to and from disk.

### Usage

```text
  Usage: polly listen|l [options]

  start the server and listen for requests

  Options:

    -H, --host <host>                host
    -p, --port <port>                port number (default: 3000)
    -n, --api-namespace <namespace>  api namespace (default: polly)
    -d, --recordings-dir <path>      recordings directory (default: recordings)
    -q, --quiet                      disable the logging
    -h, --help                       output usage information
```


================================================
FILE: docs/cli/overview.md
================================================
# Overview

The `@pollyjs/cli` package provides a standalone CLI to quickly get you setup
and ready to go.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/cli -g
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn global add @pollyjs/cli
```

## Usage

```text
  Usage: polly [options] [command]

  Options:

    -v, --version       output the version number
    -h, --help          output usage information

  Commands:

    listen|l [options]  start the server and listen for requests
```


================================================
FILE: docs/configuration.md
================================================
# Configuration

A Polly instance can be configured by passing a configuration object
to the constructor's 2nd argument:

```js
new Polly('<Recording Name>', {
  recordIfMissing: false
});
```

Or via the [configure](api#configure) method on the instance:

```js
const polly = new Polly('<Recording Name>');

polly.configure({
  recordIfMissing: false
});
```

## Defaults

[config.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/packages/@pollyjs/core/src/defaults/config.js ':include :type=code')

## logLevel

_Type_: `'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'`
_Default_: `'warn'`

Set the log level for the polly instance.

**Example**

```js
polly.configure({
  logLevel: 'info'
});
```

## recordIfMissing

_Type_: `Boolean`
_Default_: `true`

If a request's recording is not found, pass-through to the server and
record the response.

**Example**

```js
polly.configure({
  recordIfMissing: true
});
```

## recordFailedRequests

_Type_: `Boolean`
_Default_: `false`

If `false`, Polly will throw when attempting to persist any failed requests.
A request is considered to be a failed request when its response's status code
is `≥ 400`.

**Example**

```js
polly.configure({
  recordFailedRequests: true
});
```

## flushRequestsOnStop

_Type_: `Boolean`
_Default_: `false`

Await any unresolved requests handled by the polly instance
(via [flush](api#flush)) when [stop](api#stop) is called.

**Example**

```js
polly.configure({
  flushRequestsOnStop: true
});
```

## expiresIn

_Type_: `String`
_Default_: `null`

After how long the recorded request will be considered expired from the time
it was persisted. A recorded request is considered expired if the recording's
`startedDateTime` plus the current `expiresIn` duration is in the past.

**Example**

```js
polly.configure({
  expiresIn: '30d5h10m' // expires in 30 days, 5 hours, and 10 minutes
});

polly.configure({
  expiresIn: '5 min 10 seconds 100 milliseconds' // expires in 5 minutes, 10 seconds, and 100 milliseconds
});
```

## expiryStrategy

_Type_: `'warn' | 'error' | 'record'`
_Default_: `'warn'`

The strategy for what should occur when Polly tries to use an expired recording in `replay` mode. Can be one of the following:

- `warn`: Log a console warning about the expired recording.
- `error`: Throw an error.
- `record`: Re-record by making a new network request.

**Example**

```js
polly.configure({
  expiryStrategy: 'error'
});
```

## mode

_Type_: `String`
_Default_: `'replay'`

The Polly mode. Can be one of the following:

- `replay`: Replay responses from recordings.
- `record`: Force Polly to record all requests. This will overwrite recordings that already exist.
- `passthrough`: Passes all requests through directly to the server without recording or replaying.

**Example**

```js
polly.configure({
  mode: 'record'
});
```

## adapters

_Type_: `Array[String|Function]`
_Default_: `[]`

The adapter(s) polly will hook into.

**Example**

```js
import XHRAdapter from '@pollyjs/adapter-xhr';
import FetchAdapter from '@pollyjs/adapter-fetch';

// Register the xhr adapter so its accessible by all future polly instances
Polly.register(XHRAdapter);

polly.configure({
  adapters: ['xhr', FetchAdapter]
});
```

## adapterOptions

_Type_: `Object`
_Default_: `{}`

Options to be passed into the adapters keyed by the adapter name.

?> **NOTE:** Check out the appropriate documentation pages for each adapter
for more details.

**Example**

```js
polly.configure({
  adapterOptions: {
    fetch: {
      context: win
    }
  }
});
```

## persister

_Type_: `String|Function`
_Default_: `null`

The persister to use for recording and replaying requests.

**Example**

```js
import RESTPersister from '@pollyjs/persister-rest';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

// Register the local-storage persister so its accessible by all future polly instances
Polly.register(LocalStoragePersister);

polly.configure({
  persister: 'local-storage'
});

polly.configure({
  persister: RESTPersister
});
```

## persisterOptions

_Type_: `Object`
_Default_: `{}`

Options to be passed into the persister keyed by the persister name.

?> **NOTE:** Check out the appropriate documentation pages for each persister
for more details.

**Example**

```js
polly.configure({
  persisterOptions: {
    rest: {
      apiNamespace: '/polly'
    }
  }
});
```

### keepUnusedRequests

_Type_: `Boolean`
_Default_: `false`

When disabled, requests that have not been captured by the running Polly
instance will be removed from any previous recording. This ensures that a
recording will only contain the requests that were made during the lifespan
of the Polly instance. When enabled, new requests will be appended to the
recording file.

**Example**

```js
polly.configure({
  persisterOptions: {
    keepUnusedRequests: true
  }
});
```

### disableSortingHarEntries

_Type_: `Boolean`
_Default_: `false`

When disabled, entries in the the final HAR will be sorted by the request's timestamp.
This is done by default to satisfy the HAR 1.2 spec but can be enabled to improve
diff readability when committing recordings to git.

**Example**

```js
polly.configure({
  persisterOptions: {
    disableSortingHarEntries: true
  }
});
```

## timing

_Type_: `Function`
_Default_: `Timing.fixed(0)`

The timeout delay strategy used when replaying requests.

**Example**

```js
import { Timing } from '@pollyjs/core';

polly.configure({
  // Replay requests at 300% the original speed to simulate a 3g connection
  timing: Timing.relative(3.0)
});

polly.configure({
  // Replay requests with a 200ms delay
  timing: Timing.fixed(200)
});
```

## matchRequestsBy

_Type_: `Object`

_Default_:

```js
matchRequestsBy: {
  method: true,
  headers: true,
  body: true,
  order: true,

  url: {
    protocol: true,
    username: true,
    password: true,
    hostname: true,
    port: true,
    pathname: true,
    query: true,
    hash: false
  }
}
```

Request matching configuration. Each of these options are used to generate
a GUID for the request.

- ### method

  _Type_: `Boolean | Function`
  _Default_: `true`

  The request method (e.g. `GET`, `POST`)

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      method: false
    }
  });

  polly.configure({
    matchRequestsBy: {
      method(method, req) {
        return method.toLowerCase();
      }
    }
  });
  ```

- ### headers

  _Type_: `Boolean | Function | Object`
  _Default_: `true`

  The request headers.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      headers: false
    }
  });

  polly.configure({
    matchRequestsBy: {
      headers(headers, req) {
        delete headers['X-AUTH-TOKEN'];
        return headers;
      }
    }
  });
  ```

  Specific headers can also be excluded with the following:

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      headers: {
        exclude: ['X-AUTH-TOKEN']
      }
    }
  });
  ```

- ### body

  _Type_: `Boolean | Function`
  _Default_: `true`

  The request body.

  !> Please make sure you do not modify the passed in body. If you need to make changes, create a copy of it first. The body function receives the actual request body — any modifications to it will result with it being sent out with the request.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      body: false
    }
  });

  polly.configure({
    matchRequestsBy: {
      body(body, req) {
        const json = JSON.parse(body);

        delete json.email;
        return JSON.stringify(json);
      }
    }
  });
  ```

- ### order

  _Type_: `Boolean`
  _Default_: `true`

  The order the request came in. Take the following scenario:

  ```js
  // Retrieve our model
  let model = await fetch('/models/1').then((res) => res.json());

  // Modify the model
  model.foo = 'bar';

  // Save the model with our new change
  await fetch('/models/1', { method: 'POST', body: JSON.stringify(model) });

  // Get our updated model
  model = await fetch('/models/1').then((res) => res.json());

  // Assert that our change persisted
  expect(model.foo).to.equal('bar');
  ```

  The order of the requests matter since the payload for the first and
  last fetch are different.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      order: false
    }
  });
  ```

- ### url

  _Type_: `Boolean | Function | Object`
  _Default_: `{ protocol: true, username: true, ... }`

  The request url.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: false
    }
  });

  polly.configure({
    matchRequestsBy: {
      url(url, req) {
        return url.replace('test', '');
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        protocol(protocol) {
          return 'https:';
        },
        query: false
      }
    }
  });
  ```

- ### url.protocol

  _Type_: `Boolean | Function`
  _Default_: `true`

  The request url protocol (e.g. `http:`).

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        protocol: false
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        protocol(protocol, req) {
          return 'https:';
        }
      }
    }
  });
  ```

- ### url.username

  _Type_: `Boolean | Function`
  _Default_: `true`

  Username of basic authentication.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        username: false
      }
    }
  });
  polly.configure({
    matchRequestsBy: {
      url: {
        username(username, req) {
          return 'username';
        }
      }
    }
  });
  ```

- ### url.password

  _Type_: `Boolean | Function`
  _Default_: `true`

  Password of basic authentication.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        password: false
      }
    }
    matchRequestsBy: {
      url: {
        password(password, req) {
          return 'password';
        }
      }
    }
  });
  ```

- ### url.hostname

  _Type_: `Boolean | Function`
  _Default_: `true`

  Host name without port number.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        hostname: false
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        hostname(hostname, req) {
          return hostname.replace('.com', '.net');
        }
      }
    }
  });
  ```

- ### url.port

  _Type_: `Boolean | Function`
  _Default_: `true`

  Port number.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        port: false
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        port(port, req) {
          return 3000;
        }
      }
    }
  });
  ```

- ### url.pathname

  _Type_: `Boolean | Function`
  _Default_: `true`

  URL path.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        pathname(pathname, req) {
          return pathname.replace('/api/v1', '/api');
        }
      }
    }
  });
  ```

- ### url.query

  _Type_: `Boolean | Function`
  _Default_: `true`

  Sorted query string.

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        query: false
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        query(query, req) {
          return { ...query, token: '' };
        }
      }
    }
  });
  ```

- ### url.hash

  _Type_: `Boolean | Function`
  _Default_: `false`

  The "fragment" portion of the URL including the pound-sign (`#`).

  **Example**

  ```js
  polly.configure({
    matchRequestsBy: {
      url: {
        hash: true
      }
    }
  });

  polly.configure({
    matchRequestsBy: {
      url: {
        hash(hash, req) {
          return hash.replace(/token=[0-9]+/, '');
        }
      }
    }
  });
  ```


================================================
FILE: docs/examples.md
================================================
# Examples

## Client Server

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/client-server)**

[intercept.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/client-server/tests/intercept.test.js ':include :type=code')

[events.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/client-server/tests/events.test.js ':include :type=code')

## REST Persister

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/rest-persister)**

[package.json](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/rest-persister/package.json ':include :type=code')

[rest-persister.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/rest-persister/tests/rest-persister.test.js ':include :type=code')

## Node Fetch

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/node-fetch)**

[node-fetch.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/node-fetch/tests/node-fetch.test.js ':include :type=code')

## Puppeteer

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/puppeteer)**

[index.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/puppeteer/index.js ':include :type=code')

## Jest + Node Fetch

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/jest-node-fetch)**

[index.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/jest-node-fetch/__tests__/index.test.js ':include :type=code')

## TypeScript + Jest + Node Fetch

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/typescript-jest-node-fetch)**

[auto-setup-polly.ts](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/typescript-jest-node-fetch/src/utils/auto-setup-polly.ts ':include :type=code')

[github-api.test.ts](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/typescript-jest-node-fetch/src/github-api.test.ts ':include :type=code')

## Jest + Puppeteer

**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/jest-puppeteer)**

[dummy-app.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/jest-puppeteer/__tests__/dummy-app.test.js ':include :type=code')


================================================
FILE: docs/frameworks/ember-cli.md
================================================
# Ember CLI

Installing the `@pollyjs/ember` addon will import and vendor the necessary
Polly.JS packages as well as register the [Express API](node-server/express-integrations)
required by the [REST Persister](persisters/rest).

?> **NOTE:** By default, this addon installs and registers the
[XHR](adapters/xhr) & [Fetch](adapters/fetch) adapters as well as the
[REST](persisters/rest) & [Local Storage](persisters/local-storage) persisters.

## Installation

```bash
ember install @pollyjs/ember
```

## Configuration

Addon and [server API configuration](node-server/overview#api-configuration) can be
be specified in `<ember app root>/config/polly.js`. The default configuration options are shown below.

```js
module.exports = function(env) {
  return {
    // Addon Configuration Options
    enabled: env !== 'production',

    // Server Configuration Options
    server: {
      apiNamespace: '/polly',
      recordingsDir: 'recordings'
    }
  };
};
```

## Usage

Once installed and configured, you can import and use Polly as documented. Check
out the [Quick Start](quick-start#usage) documentation to get started.

?> For an even better testing experience, check out the provided
[QUnit Test Helper](test-frameworks/qunit)!


================================================
FILE: docs/index.html
================================================
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Polly.JS</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta
      name="description"
      content="Standalone, framework-agnostic JavaScript library that enables recording, replaying, and stubbing HTTP interactions."
    />
    <meta
      name="viewport"
      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
    />
    <meta name="twitter:title" content="Polly.JS" />
    <meta
      name="twitter:description"
      content="Standalone, framework-agnostic JavaScript library that enables recording, replaying, and stubbing HTTP interactions."
    />
    <meta
      name="twitter:image"
      content="https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt-twitter.png"
    />
    <meta name="twitter:card" content="summary_large_image" />
    <link
      rel="shortcut icon"
      href="assets/images/favicon.ico"
      type="image/x-icon"
    />
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" />
    <link rel="stylesheet" href="assets/styles.css" />
  </head>

  <body>
    <div id="app"></div>

    <script>
      window.$docsify = {
        name: 'Polly.JS',
        logo: 'assets/images/logo.png',
        loadSidebar: true,
        coverpage: true,
        onlyCover: true,
        auto2top: true,
        autoHeader: false,
        subMaxLevel: 3,
        maxLevel: 4,
        repo: 'https://github.com/Netflix/pollyjs',
        alias: {
          '/.*/_sidebar.md': '/_sidebar.md',
          '.*?/CHANGELOG':
            'https://raw.githubusercontent.com/Netflix/pollyjs/master/CHANGELOG',
          '.*?/CONTRIBUTING':
            'https://raw.githubusercontent.com/Netflix/pollyjs/master/CONTRIBUTING'
        },
        homepage:
          'https://raw.githubusercontent.com/Netflix/pollyjs/master/README.md',
        search: {
          paths: 'auto',
          placeholder: 'Search',
          noData: 'No Results.'
        },
        ga: 'UA-120716183-1'
      };
    </script>
    <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
    <script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
    <script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
    <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
    <script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
    <script src="//unpkg.com/docsify-copy-code@2"></script>
    <script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
    <script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
  </body>
</html>


================================================
FILE: docs/node-server/express-integrations.md
================================================
# Express Integrations

The `@pollyjs/node-server` package exports a `registerExpressAPI` method which
takes in an [Express](http://expressjs.com/) app and a config to register the
necessary routes to be used with the REST Persister.

```js
const { registerExpressAPI } = require('@pollyjs/node-server');

registerExpressAPI(app, config);
```

## Webpack DevServer

```js
const path = require('path');
const { registerExpressAPI } = require('@pollyjs/node-server');

const config = {
  devServer: {
    before(app) {
      registerExpressAPI(app, config);
    }
  }
};

module.exports = config;
```

## Ember CLI

See the [Ember CLI Addon](frameworks/ember-cli) documentation for more details.


================================================
FILE: docs/node-server/overview.md
================================================
# Overview

The `@pollyjs/node-server` package provides a standalone node server as well as
an express integration to be able to support the [REST Persister](persisters/rest)
so recordings can be saved to and read from disk.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/node-server -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/node-server -D
```

## Server

This packages includes a fully working standalone node server that is pre-configured
with the necessary APIs and middleware to support the [REST Persister](persisters/rest).

The Server constructor accepts a configuration object that can be a combination
of the below listed Server & API options. Once instantiated, you will have
full access to the Express app via the `app` property.

```js
const { Server } = require('@pollyjs/node-server');
const server = new Server({
  quiet: true,
  port: 4000,
  apiNamespace: '/polly'
});

// Add custom business logic to the express server
server.app.get('/custom', () => {
  /* Add custom express logic */
});

// Start listening and attach extra logic to the http server
server.listen().on('error', () => {
  /* Add http server error logic */
});
```

## Server Configuration

### port

_Type_: `Number`
_Default_: `3000`

```js
new Server({
  port: 4000
});
```

### host

_Type_: `String`
_Default_: `undefined`

```js
new Server({
  host: 'test.localhost'
});
```

### quiet

_Type_: `Boolean`
_Default_: `false`

Enable/Disable the logging middleware ([morgan](https://github.com/expressjs/morgan)).

```js
new Server({
  quiet: true
});
```

### corsOptions

_Type_: `Object | Function`
_Default_: `undefined`

Options passed to the ([CORS](https://github.com/expressjs/cors)) middleware.

```js
new Server({
  corsOptions: {
    origin: 'http://localhost:4000',
    credentials: true
  }
});
```

## API Configuration

### recordingsDir

_Type_: `String`
_Default_: `'recordings'`

The root directory to store all recordings.

```js
new Server({
  recordingsDir: '__recordings__'
});

registerExpressAPI(app, {
  recordingsDir: '__recordings__'
});
```

### apiNamespace

_Type_: `String`
_Default_: `'polly'`

The namespace to mount the polly API on. This should really only be changed
if there is a conflict with the default apiNamespace.

!> If modified, you must provide the new `apiNamespace` to the client side Polly
instance via the [Persister Options](persisters/rest#apinamespace)

```js
new Server({
  apiNamespace: '/polly'
});

registerExpressAPI(app, {
  apiNamespace: '/polly'
});
```

### recordingSizeLimit

_Type_: `String`
_Default_: `'50mb'`

A recording size can not exceed 50mb by default. If your application exceeds this limit, bump this value to a reasonable limit.

```js
new Server({
  recordingSizeLimit: '50mb'
});

registerExpressAPI(app, {
  recordingSizeLimit: '50mb'
});
```


================================================
FILE: docs/persisters/custom.md
================================================
# Custom Persister

If you need to create your own persister or modify an pre-existing one, you've come
to the right page!

## Creating a Custom Persister

The `@pollyjs/persister` package provides an extendable base persister class that
contains core logic dependent on by the [REST](persisters/rest)
& [Local Storage](persisters/local-storage) persisters.

### Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/persister -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/persister -D
```

### Usage

```js
import Persister from '@pollyjs/persister';

class CustomPersister extends Persister {
  static get id() {
    return 'custom';
  }

  onFindRecording() {}

  onSaveRecording() {}

  onDeleteRecording() {}
}
```

For better usage examples, please refer to the source code for
the [REST](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/core/src/persisters/rest/index.js) & [Local Storage](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/core/src/persisters/local-storage/index.js) persisters.

## Extending from an Existing Persister

The `@pollyjs/core` package exports the `RESTPersister` and `LocalStoragePersister` classes,
allowing you to modify them as needed.

```js
import RESTPersister from '@pollyjs/persister-rest';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

class CustomRESTPersister extends RESTPersister {}
class CustomLocalStoragePersister extends LocalStoragePersister {}
```

## Registering & Connecting to a Custom Persister

You can register and connect to a custom persister by passing an array to the `persister`
config where the first element is the name of your persister and the second is the
persister class.

```js
// Register and connect to a custom persister:
new Polly('Custom Persister', {
  persister: MyCustomPersisterClass
});

// Register and connect to a custom persister via .configure():
const polly = new Polly('Custom Persister');

polly.configure({
  persister: MyCustomPersisterClass
});
```


================================================
FILE: docs/persisters/fs.md
================================================
# File System Persister

Read and write recordings to and from the file system.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/persister-fs -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/persister-fs -D
```

## Usage

```js
import { Polly } from '@pollyjs/core';
import FSPersister from '@pollyjs/persister-fs';

// Register the fs persister so its accessible by all future polly instances
Polly.register(FSPersister);

new Polly('<Recording Name>', {
  persister: 'fs'
});
```

## Options

### recordingsDir

_Type_: `String`
_Default_: `'recordings'`

The root directory to store all recordings. Supports both relative and
absolute paths.

**Example**

```js
polly.configure({
  persisterOptions: {
    fs: {
      recordingsDir: '__recordings__'
    }
  }
});
```


================================================
FILE: docs/persisters/local-storage.md
================================================
# Local Storage Persister

Read and write recordings to and from the browser's Local Storage.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/persister-local-storage -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/persister-local-storage -D
```

## Usage

```js
import { Polly } from '@pollyjs/core';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

// Register the local-storage persister so its accessible by all future polly instances
Polly.register(LocalStoragePersister);

new Polly('<Recording Name>', {
  persister: 'local-storage'
});
```

## Options

### context

_Type_: `Object`
_Default_: `global|self|window`

The context object which contains the localStorage API.
Typically this is `window` or `self` in the browser and `global` in node.

**Example**

```js
polly.configure({
  persisterOptions: {
    'local-storage': {
      context: window
    }
  }
});
```

### key

_Type_: `String`
_Default_: `'pollyjs'`

The localStorage key to store the recordings data under.

**Example**

```js
polly.configure({
  persisterOptions: {
    'local-storage': {
      key: '__pollyjs__'
    }
  }
});
```


================================================
FILE: docs/persisters/rest.md
================================================
# REST Persister

Read and write recordings to and from the file system via a CRUD API hosted
on a server.

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/persister-rest -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/persister-rest -D
```

## Setup

This library provides a fully functional [node server](node-server/overview)
as well as a [CLI](cli/overview) to get you up and running.

## Usage

```js
import { Polly } from '@pollyjs/core';
import RESTPersister from '@pollyjs/persister-rest';

// Register the rest persister so its accessible by all future polly instances
Polly.register(RESTPersister);

new Polly('<Recording Name>', {
  persister: 'rest'
});
```

## Options

### host

_Type_: `String`
_Default_: `'http://localhost:3000'`

The host that the API exists on.

**Example**

```js
polly.configure({
  persisterOptions: {
    rest: {
      host: 'http://localhost.com:4000'
    }
  }
});
```

### apiNamespace

_Type_: `String`
_Default_: `'/polly'`

The API namespace.

The namespace the Polly API is mounted on. This should really only be changed
if there is a conflict with the default apiNamespace.

!> If modified, you must provide the new `apiNamespace` to the node server
via the [Node Server apiNamespace](node-server/overview#apinamespace) configuration
option.

**Example**

```js
polly.configure({
  persisterOptions: {
    rest: {
      apiNamespace: '/polly'
    }
  }
});
```


================================================
FILE: docs/quick-start.md
================================================
# Quick Start

## Installation

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/core -D
```

If you want to install it with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/core -D
```

## How it Works

Once instantiated, Polly will hook into native implementations (such as fetch & XHR)
via adapters to intercept any outgoing requests. Depending on its current
[mode](configuration#mode) as well as rules defined via the
[client-side server](server/overview), the request will either be replayed, recorded,
passed-through, or intercepted.

## Adapters & Persisters

Before you start using Polly, you'll need to install the necessary adapters and
persisters depending on your application/environment. Adapters provide
functionality that allows Polly to intercept requests via different sources
(e.g. XHR, fetch, Puppeteer) while Persisters provide the functionality to read & write
recorded data (e.g. fs, local-storage).

Check out the appropriate documentation pages for each adapter and persister
for more details such as installation, usage, and available options.

_Note that you must have node (and npm) installed._

```bash
npm install @pollyjs/adapter-{name} -D
npm install @pollyjs/persister-{name} -D
```

If you want to install them with [yarn](https://yarnpkg.com):

```bash
yarn add @pollyjs/adapter-{name} -D
yarn add @pollyjs/persister-{name} -D
```

Once installed, you can register the adapters and persisters with Polly so
they can easily be referenced by name later.

```js
import { Polly } from '@pollyjs/core';
import FetchAdapter from '@pollyjs/adapter-fetch';
import XHRAdapter from '@pollyjs/adapter-xhr';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

Polly.register(FetchAdapter);
Polly.register(XHRAdapter);
Polly.register(LocalStoragePersister);

new Polly('<Recording Name>', {
  adapters: ['fetch', 'xhr'],
  persister: 'local-storage'
});
```

## Using Polly in the Browser?

Polly fully supports native in-browser usage, but because browsers can't write
to disk in the same way as conventional applications considerations need to be
made for persisting recordings.

If permanent, long-term persistence is not required then you can simply use the
[Local Storage Persister](persisters/local-storage), which writes to
`window.localStorage`.

For conventional file system storage you will need to use the
[REST Persister](persisters/rest) which runs as a separate process listening for
PollyJS activity. The server can be run in 2 ways. Firstly via the provided
[CLI](cli/overview)'s [listen](cli/commands#listen) command:

```bash
npm install @pollyjs/cli -g
polly listen
```

However, secondly there is also a convenient
[Express Integration](node-server/express-integrations) that appends the REST
server's endpoints to an existing server such as
[Webpack's Dev Server](https://webpack.js.org/configuration/dev-server/).

## Usage

Now that you've installed and setup Polly, you're ready to fly. Lets take a
look at what a simple example test case would look like using Polly.

```js
import { Polly } from '@pollyjs/core';
import FetchAdapter from '@pollyjs/adapter-fetch';
import LocalStoragePersister from '@pollyjs/persister-local-storage';

/*
  Register the adapters and persisters we want to use. This way all future
  polly instances can access them by name.
*/
Polly.register(FetchAdapter);
Polly.register(LocalStoragePersister);

describe('Simple Example', function () {
  it('fetches a post', async function () {
    /*
      Create a new polly instance.

      Connect Polly to fetch. By default, it will record any requests that it
      hasn't yet seen while replaying ones it has already recorded.
    */
    const polly = new Polly('Simple Example', {
      adapters: ['fetch'], // Hook into `fetch`
      persister: 'local-storage', // Read/write to/from local-storage
      logLevel: 'info' // Log requests to console
    });

    const response = await fetch(
      'https://jsonplaceholder.typicode.com/posts/1'
    );
    const post = await response.json();

    expect(response.status).to.equal(200);
    expect(post.id).to.equal(1);

    /*
      Calling `stop` will persist requests as well as disconnect from any
      connected adapters.
    */
    await polly.stop();
  });
});
```

<p data-height="500" data-theme-id="light" data-slug-hash="EdBZry" data-default-tab="js,result" data-user="offirgolan" data-pen-title="Polly.JS Simple Example" class="codepen">See the Pen <a href="https://codepen.io/offirgolan/pen/EdBZry/">Polly.JS Simple Example</a> on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

The first time the test runs, Polly will record the response for the
`fetch('https://jsonplaceholder.typicode.com/posts/1')` request that was made. You will
see the following in the console:

```text
Recorded ➞ GET https://jsonplaceholder.typicode.com/posts/1 200 • 48ms
```

Once the Polly instance is [stopped](api#stop-1), the persister will generate the
following [HAR](http://www.softwareishard.com/blog/har-12-spec/) file which will
be used to replay the response to that request when the test is rerun:

```json
{
  "Simple-Example_823972681": {
    "log": {
      "_recordingName": "Simple Example",
      "browser": {
        "name": "Chrome",
        "version": "70.0"
      },
      "creator": {
        "comment": "persister:local-storage",
        "name": "Polly.JS",
        "version": "1.2.0"
      },
      "entries": [
        {
          "_id": "ffbc4836d419fc265c3b85cbe1b7f22e",
          "_order": 0,
          "cache": {},
          "request": {
            "bodySize": 0,
            "cookies": [],
            "headers": [],
            "headersSize": 63,
            "httpVersion": "HTTP/1.1",
            "method": "GET",
            "queryString": [],
            "url": "https://jsonplaceholder.typicode.com/posts/1"
          },
          "response": {
            "bodySize": 292,
            "content": {
              "mimeType": "application/json; charset=utf-8",
              "size": 292,
              "text": "{\n  \"userId\": 1,\n  \"id\": 1,\n  \"title\": \"sunt aut facere repellat provident occaecati excepturi optio reprehenderit\",\n  \"body\": \"quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto\"\n}"
            },
            "cookies": [],
            "headers": [
              {
                "name": "cache-control",
                "value": "public, max-age=14400"
              },
              {
                "name": "content-type",
                "value": "application/json; charset=utf-8"
              },
              {
                "name": "expires",
                "value": "Tue, 30 Oct 2018 22:52:42 GMT"
              },
              {
                "name": "pragma",
                "value": "no-cache"
              }
            ],
            "headersSize": 145,
            "httpVersion": "HTTP/1.1",
            "redirectURL": "",
            "status": 200,
            "statusText": "OK"
          },
          "startedDateTime": "2018-10-30T18:52:42.566Z",
          "time": 18,
          "timings": {
            "blocked": -1,
            "connect": -1,
            "dns": -1,
            "receive": 0,
            "send": 0,
            "ssl": -1,
            "wait": 18
          }
        }
      ],
      "pages": [],
      "version": "1.2"
    }
  }
}
```

The next time the test is run, Polly will use the recorded response instead
of going out to the server to get a new one. You will see the following in the
console:

```text
Replayed ➞ GET https://jsonplaceholder.typicode.com/posts/1 200 • 1ms
```

## Client-Side Server

Every Polly instance has a reference to a [client-side server](server/overview)
which you can leverage to gain full control of all HTTP interactions as well as
dictate how the Polly instance should handle them.

Lets take a look at how we can modify our previous test case to test against a
post that does not exist.

```js
describe('Simple Client-Side Server Example', function () {
  it('fetches an unknown post', async function () {
    /*
      Create a new polly instance.

      Connect Polly to fetch. By default, it will record any requests that it
      hasn't yet seen while replaying ones it has already recorded.
    */
    const polly = new Polly('Simple Client-Side Server Example', {
      adapters: ['fetch'], // Hook into `fetch`
      persister: 'local-storage', // Read/write to/from local-storage
      logLevel: 'info' // Log requests to console
    });
    const { server } = polly;

    /*
      Add a rule via the client-side server to intercept the
      `https://jsonplaceholder.typicode.com/posts/404` request and return
      an error.
    */
    server
      .get('https://jsonplaceholder.typicode.com/posts/404')
      .intercept((req, res) => {
        res.status(404).json({ error: 'Post not found.' });
      });

    const response = await fetch(
      'https://jsonplaceholder.typicode.com/posts/404'
    );
    const post = await response.json();

    expect(response.status).to.equal(404);
    expect(post.error).to.equal('Post not found.');

    /*
      Calling `stop` will persist requests as well as disconnect from any
      connected adapters.
    */
    await polly.stop();
  });
});
```

<p data-height="600" data-theme-id="light" data-slug-hash="OBebwW" data-default-tab="js,result" data-user="offirgolan" data-pen-title="Polly.JS Simple Client-Side Server Example" class="codepen">See the Pen <a href="https://codepen.io/offirgolan/pen/OBebwW/">Polly.JS Simple Client-Side Server Example</a> on <a href="https://codepen.io">CodePen</a>.</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

When the test executes, Polly will detect that we've set a custom intercept rule for
`https://jsonplaceholder.typicode.com/posts/404` and will deffer to the intercept handler
to handle the response for that request. You will see the following in the console:

```text
Intercepted ➞ GET https://jsonplaceholder.typicode.com/posts/404 404 • 1ms
```

## Test Helpers

Using Mocha or QUnit? We've got you covered! Checkout the [Mocha](test-frameworks/mocha) or
[QUnit](test-frameworks/qunit) documentation pages for detailed instructions
on how to use the provided test helpers.


================================================
FILE: docs/server/api.md
================================================
# API

## HTTP Methods

The `GET`, `PUT`, `POST`, `PATCH`, `DELETE`, `MERGE`, `HEAD`, and `OPTIONS` HTTP methods
have a corresponding method on the server instance.

```js
server.get('/ping');
server.put('/ping');
server.post('/ping');
server.patch('/ping');
server.delete('/ping');
server.merge('/ping');
server.head('/ping');
server.options('/ping');
```

Each of these methods returns a [Route Handler](server/route-handler.md) which
you can use to pass-through, intercept, and attach events to.

```js
server.get('/ping').passthrough();
server.put('/ping').intercept((req, res) => res.sendStatus(200));
server.post('/ping').on('request', req => {
  /* Do Something */
});
server.patch('/ping').off('request');
```

## any

Declare [Events & Middleware](server/events-and-middleware#middleware) globally
or for a specific route.

**Example**

```js
server.any('/session/:id').on('request', (req, res) => {
  req.query.email = 'test@netflix.com';
});
```

## host

Define a block where all methods will inherit the provided host.

**Example**

```js
server.host('http://netflix.com', () => {
  // Middleware will be attached to the host
  server.any().on('request', req => {});

  server.get('/session').intercept(() => {}); // → http://netflix.com/session
});
```

## namespace

Define a block where all methods will inherit the provided namespace.

**Example**

```js
server.namespace('/api', () => {
  // Middleware will be attached to the namespace
  server.any().on('request', req => {});

  server.get('/session').intercept(() => {}); // → /api/session

  server.namespace('/v2', () => {
    server.get('/session').intercept(() => {}); // → /api/v2/session
  });
});
```

## timeout

Returns a promise that will resolve after the given number of milliseconds.

**Example**

```js
server.get('/ping').intercept(async (req, res) => {
  await server.timeout(500);
  res.sendStatus(200);
});
```


================================================
FILE: docs/server/event.md
================================================
# Event

## Properties

### type

_Type_: `String`

The event type. (e.g. `request`, `response`, `beforePersist`)

## Methods

### stopPropagation

If several event listeners are attached to the same event type, they are called in the order in which they were added. If `stopPropagation` is invoked during one such call, no remaining listeners will be called.

**Example**

```js
server.get('/session/:id').on('beforeResponse', (req, res, event) => {
  event.stopPropagation();
  res.setHeader('X-SESSION-ID', 'ABC123');
});

server.get('/session/:id').on('beforeResponse', (req, res, event) => {
  // This will never be reached
  res.setHeader('X-SESSION-ID', 'XYZ456');
});
```


================================================
FILE: docs/server/events-and-middleware.md
================================================
# Events & Middleware

## Events

Events can be attached to a server route using `.on()` and detached via
the `.off()` methods.

?> **NOTE:** Event handlers can be asynchronous. An `async` function can be used
or a `Promise` can be returned.

```js
// Events
server
  .get('/')
  .on('request', req => {})
  .off('request');

// Passthrough w/ Events
server
  .get('/')
  .passthrough()
  .on('beforeResponse', (req, res) => {})
  .off('beforeResponse');

// Intercept w/ Events
server
  .get('/', (req, res) => {})
  .on('request', req => {})
  .on('beforeResponse', (req, res) => {});

// Middleware w/ Events
server
  .any('/')
  .on('request', req => {})
  .on('beforeResponse', (req, res) => {});
```

### request

Fires right before the request goes out.

| Param | Type                      | Description          |
| ----- | ------------------------- | -------------------- |
| req   | [Request](server/request) | The request instance |
| event | [Event](server/event)     | The event instance   |

**Example**

```js
server.get('/session').on('request', req => {
  req.headers['X-AUTH'] = '<ACCESS_TOKEN>';
  req.query.email = 'test@app.com';
});
```

### beforeResponse

Fires right before the response materializes and the promise resolves.

| Param | Type                        | Description           |
| ----- | --------------------------- | --------------------- |
| req   | [Request](server/request)   | The request instance  |
| res   | [Response](server/response) | The response instance |
| event | [Event](server/event)       | The event instance    |

**Example**

```js
server.get('/session').on('beforeResponse', (req, res) => {
  res.setHeader('X-AUTH', '<ACCESS_TOKEN>');
});
```

### response

Fires right after the response has been finalized for the request but before
the response materializes and the promise resolves.

| Param | Type                        | Description           |
| ----- | --------------------------- | --------------------- |
| req   | [Request](server/request)   | The request instance  |
| res   | [Response](server/response) | The response instance |
| event | [Event](server/event)       | The event instance    |

**Example**

```js
server.get('/session').on('response', (req, res) => {
  console.log(
    `${req.url} took ${req.responseTime}ms with a status of ${res.statusCode}.`
  );
});
```

### beforePersist

Fires before the request/response gets persisted.

| Param     | Type                      | Description                          |
| --------- | ------------------------- | ------------------------------------ |
| req       | [Request](server/request) | The request instance                 |
| recording | `Object`                  | The recording that will be persisted |
| event     | [Event](server/event)     | The event instance                   |

**Example**

```js
server.any().on('beforePersist', (req, recording) => {
  recording.request = encrypt(recording.request);
  recording.response = encrypt(recording.response);
});
```

### beforeReplay

Fires after retrieving the recorded request/response from the persister
and before the recording materializes into a response.

| Param     | Type                      | Description             |
| --------- | ------------------------- | ----------------------- |
| req       | [Request](server/request) | The request instance    |
| recording | `Object`                  | The retrieved recording |
| event     | [Event](server/event)     | The event instance      |

**Example**

```js
server.any().on('beforeReplay', (req, recording) => {
  recording.request = decrypt(recording.request);
  recording.response = decrypt(recording.response);
});
```

### error

Fires when any error gets emitted during the request life-cycle.

| Param | Type                      | Description          |
| ----- | ------------------------- | -------------------- |
| req   | [Request](server/request) | The request instance |
| error | Error                     | The error            |
| event | [Event](server/event)     | The event instance   |

**Example**

```js
server.any().on('error', (req, error) => {
  console.error(error);
  process.exit(1);
});
```

### abort

Fires when a request is aborted.

| Param | Type                      | Description          |
| ----- | ------------------------- | -------------------- |
| req   | [Request](server/request) | The request instance |
| event | [Event](server/event)     | The event instance   |

**Example**

```js
server.any().on('abort', req => {
  console.error('Request aborted.');
  process.exit(1);
});
```

## Middleware

Middleware can be added via the `.any()` method.

?> **NOTE:** Middleware events will be executed by the order in which they were
declared.

### Global Middleware

The following is an example of a global middleware that will be attached to all
routes. This middleware in specific overrides the `X-Auth-Token` with a test token.

```js
server.any().on('request', (req, res) => {
  req.headers['X-Auth-Token'] = 'abc123';
});
```

### Route Level Middleware

The following is an example of a route level middleware that will be attached to
any route that matches `/session/:id`. This middleware in specific overrides
the email query param with that of a test email.

```js
server.any('/session/:id').on('request', (req, res) => {
  req.query.email = 'test@netflix.com';
});
```


================================================
FILE: docs/server/overview.md
================================================
# Overview

Every polly instance has a reference to a client-side server which you can leverage
to gain full control of all HTTP interactions as well as dictate how the Polly instance
should handle them.

## Usage

```js
const polly = new Polly('<Recording Name>');
const { server } = polly;

// Events & Middleware
server.any().on('request', (req, res) => {
  req.headers['X-Auth-Token'] = 'abc123';
});

// Intercept requests
server.get('/session').intercept((req, res) => {
  res.status(200).json({ user: { email: 'test@netflix.com' } });
});

// Passthrough requests
server.get('/coverage').passthrough();
```

## Defining Routes

The server uses [Route Recognizer](https://github.com/tildeio/route-recognizer)
under the hood. This allows you to define static routes, as well as dynamic,
and starred segments.

**Example**

```js
// Static Routes
server.get('/api/v2/users').intercept((req, res) => {
  res.sendStatus(200);
});

// Dynamic Segments
server.get('http://netflix.com/movies/:id').intercept((req, res) => {
  console.log(req.params.id); // http://netflix.com/movies/1 → '1'
  res.sendStatus(200);
});

// Starred Segments
server.get('/secrets/*path').intercept((req, res) => {
  console.log(req.params.path); // /secrets/foo/bar → 'foo/bar'
  res.status(401).send('Shhh!');
});
```

### Multi Route Handlers

HTTPS methods as well as `.any()` accept a single string
as well as an array of strings.

**Example**

```js
// Match against '/api/v2/users' as well as any child route
server.get(['/api/v2/users', '/api/v2/users/*path']).passthrough();

// Register the same event handler on both '/session' and '/users/session'
server.any(['/session', '/users/session']).on('request', () => {});
```


================================================
FILE: docs/server/request.md
================================================
# Request

## Properties

### method

_Type_: `String`

The request method. (e.g. `GET`, `POST`, `DELETE`)

### url

_Type_: `String`

The request URL.

### protocol

_Type_: `String`

The request url protocol. (e.g. `http://`, `https:`)

### hostname

_Type_: `String`

The request url host name. (e.g. `localhost`, `netflix.com`)

### port

_Type_: `String`

The request url port. (e.g. `3000`)

### pathname

_Type_: `String`

The request url path name. (e.g. `/session`, `/movies/1`)

### hash

_Type_: `String`

The request url hash.

### headers

_Type_: `Object`
_Default_: `{}`

The request headers.

### body

_Type_: `any`

The request body.

### query

_Type_: `Object`
_Default_: `{}`

The request url query parameters.

### params

_Type_: `Object`
_Default_: `{}`

The matching route's path params.

**Example**

```js
server.get('/movies/:id').intercept((req, res) => {
  console.log(req.params.id);
});
```

### recordingName

_Type_: `String`

The recording the request should be recorded under.

## Methods

### getHeader

Get a header with a given name.

| Param       | Type                | Description            |
| ----------- | ------------------- | ---------------------- |
| name        | `String`            | The name of the header |
| **Returns** | `String` \| `Array` | The header value       |

**Example**

```js
req.getHeader('Content-Type'); // → application/json
```

### setHeader

Set a header with a given name. If the value is `null` or `undefined`, the header will be
removed.

| Param       | Type                      | Description              |
| ----------- | ------------------------- | ------------------------ |
| name        | `String`                  | The name of the header   |
| value       | `String` \| `Array`       | The value for the header |
| **Returns** | [Request](server/request) | The current request      |

**Example**

```js
req.setHeader('Content-Length', 42);
```

### setHeaders

Add multiple headers at once. If a value is `null` or `undefined`, the header will be
removed.

| Param       | Type                      | Description                       |
| ----------- | ------------------------- | --------------------------------- |
| headers     | `Object`                  | The headers to add to the request |
| **Returns** | [Request](server/request) | The current request               |

**Example**

```js
req.setHeaders({
  Accept: ['text/html', 'image/*'],
  'Content-Type': 'application/json',
  'Content-Length': 42
});
```

### removeHeader

Remove a header with the given name.

| Param       | Type                      | Description            |
| ----------- | ------------------------- | ---------------------- |
| name        | `String`                  | The name of the header |
| **Returns** | [Request](server/request) | The current request    |

**Example**

```js
req.removeHeader('Content-Length');
```

### removeHeaders

Remove multiple headers at once.

| Param       | Type                      | Description                            |
| ----------- | ------------------------- | -------------------------------------- |
| headers     | `Array`                   | The headers to remove from the request |
| **Returns** | [Request](server/request) | The current request                    |

**Example**

```js
req.removeHeaders(['Content-Type' 'Content-Length']);
```

### hasHeader

Returns 'true' or 'false' depending on if the request has the given header.

| Param       | Type      | Description            |
| ----------- | --------- | ---------------------- |
| name        | `String`  | The name of the header |
| **Returns** | `Boolean` | &nbsp;                 |

**Example**

```js
req.hasHeader('X-AUTH'); // → false
```

### type

Sets the request's Content Type.

| Param       | Type                      | Description         |
| ----------- | ------------------------- | ------------------- |
| value       | `String`                  | &nbsp;              |
| **Returns** | [Request](server/request) | The current request |

### send

Sets the request's body.

- If the body is a `String`, it defaults the content type to `text/html` if does not exist.
- If the body is a `String` and no charset is found, a `utf-8` charset is appended to the content type.
- Body that is a `Boolean`, `Number`, or `Object` gets passed to the [json](#json) method.

| Param       | Type                      | Description         |
| ----------- | ------------------------- | ------------------- |
| body        | `any`                     | &nbsp;              |
| **Returns** | [Request](server/request) | The current request |

**Example**

```js
req.send('Hello World');
req.send(200);
req.send(true);
req.send();
```

### json

A shortcut method to set the content type to `application/json` if it hasn't
been set already, and call [send](#send) with the stringified object.

| Param       | Type                      | Description         |
| ----------- | ------------------------- | ------------------- |
| obj         | `Object`                  | Object to send      |
| **Returns** | [Request](server/request) | The current request |

**Example**

```js
req.json({ Hello: 'World' });
```

### jsonBody

A shortcut method that calls JSON.parse on the request's body.

!> This method will throw if the body is an invalid JSON string.

| Param       | Type     | Description          |
| ----------- | -------- | -------------------- |
| **Returns** | `Object` | The JSON parsed body |

**Example**

```js
req.jsonBody();
```

### overrideRecordingName

Override the recording name for the request.

| Param         | Type     | Description            |
| ------------- | -------- | ---------------------- |
| recordingName | `String` | The new recording name |

**Example**

```js
req.overrideRecordingName(req.hostname);
```

### configure

Override configuration options for the request.

| Param  | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| config | `Object` | [Configuration](configuration) object |

**Example**

```js
req.configure({ recordFailedRequests: true });

req.configure({ timing: Timing.relative(3.0) });

req.configure({ logLevel: 'info' });
```


================================================
FILE: docs/server/response.md
================================================
# Response

## Properties

### statusCode

_Type_: `Number`
_Default_: `undefined`

The response's status code.

### headers

_Type_: `Object`
_Default_: `{}`

The response's headers.

### body

_Type_: `String`
_Default_: `undefined`

The response's body.

## Methods

### status

Set the response's status code.

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| status      | `Number`                    | Status code          |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.status(200);
```

### getHeader

Get a header with a given name.

| Param       | Type                | Description            |
| ----------- | ------------------- | ---------------------- |
| name        | `String`            | The name of the header |
| **Returns** | `String` \| `Array` | The header value       |

**Example**

```js
res.getHeader('Content-Type'); // → application/json
```

### setHeader

Set a header with a given name. If the value is `null` or `undefined`, the header will be
removed.

| Param       | Type                        | Description              |
| ----------- | --------------------------- | ------------------------ |
| name        | `String`                    | The name of the header   |
| value       | `String` \| `Array`         | The value for the header |
| **Returns** | [Response](server/response) | The current response     |

**Example**

```js
res.setHeader('Content-Length', 42);
```

### setHeaders

Add multiple headers at once. If a value is `null` or `undefined`, the header will be
removed.

| Param       | Type                        | Description                        |
| ----------- | --------------------------- | ---------------------------------- |
| headers     | `Object`                    | The headers to add to the response |
| **Returns** | [Response](server/response) | The current response               |

**Example**

```js
res.setHeaders({
  Accept: ['text/html', 'image/*'],
  'Content-Type': 'application/json',
  'Content-Length': 42
});
```

### removeHeader

Remove a header with the given name.

| Param       | Type                        | Description            |
| ----------- | --------------------------- | ---------------------- |
| name        | `String`                    | The name of the header |
| **Returns** | [Response](server/response) | The current response   |

**Example**

```js
res.removeHeader('Content-Length');
```

### removeHeaders

Remove multiple headers at once.

| Param       | Type                        | Description                             |
| ----------- | --------------------------- | --------------------------------------- |
| headers     | `Array`                     | The headers to remove from the response |
| **Returns** | [Response](server/response) | The current response                    |

**Example**

```js
res.removeHeaders(['Content-Type' 'Content-Length']);
```

### hasHeader

Returns 'true' or 'false' depending on if the response has the given header.

| Param       | Type      | Description            |
| ----------- | --------- | ---------------------- |
| name        | `String`  | The name of the header |
| **Returns** | `Boolean` | &nbsp;                 |

**Example**

```js
res.hasHeader('X-AUTH'); // → false
```

### type

Sets the response's Content Type.

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| value       | `String`                    | &nbsp;               |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.type('application/json');
```

### send

Sets the response's body.

- If the body is a `String`, it defaults the content type to `text/html` if does not exist.
- If the body is a `String` and no charset is found, a `utf-8` charset is appended to the content type.
- Body that is a `Boolean`, `Number`, or `Object` gets passed to the [json](#json) method.

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| body        | `any`                       | &nbsp;               |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.send('Hello World');
res.send(200);
res.send(true);
res.send();
```

### sendStatus

A shortcut method to set the status to the given status code, set the content
type to `text/plain`, and call [send](#send).

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| status      | `Number`                    | Status code          |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.sendStatus(200);
```

### json

A shortcut method to set the content type to `application/json` if it hasn't
been set already, and call [send](#send) with the stringified object.

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| obj         | `Object`                    | Object to send       |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.json({ Hello: 'World' });
```

### jsonBody

A shortcut method that calls JSON.parse on the response's body.

!> This method will throw if the body is an invalid JSON string.

| Param       | Type     | Description          |
| ----------- | -------- | -------------------- |
| **Returns** | `Object` | The JSON parsed body |

**Example**

```js
res.jsonBody();
```

### end

Freeze the response and headers so they can no longer be modified.

| Param       | Type                        | Description          |
| ----------- | --------------------------- | -------------------- |
| **Returns** | [Response](server/response) | The current response |

**Example**

```js
res.end();
```


================================================
FILE: docs/server/route-handler.md
================================================
# Route Handler

An object that is returned when calling any of the server's HTTP methods as well
as `server.any()`.

## Methods

?> **NOTE:** Event & Intercept handlers can be asynchronous. An `async`
function can be used or a `Promise` can be returned.

### on

Register an [event](server/events-and-middleware) handler.

?> **Tip:** You can attach multiple handlers to a single event. Handlers will be
called in the order they were declared.

| Param         | Type       | Description                                                      |
| ------------- | ---------- | ---------------------------------------------------------------- |
| eventName     | `String`   | The event name                                                   |
| handler       | `Function` | The event handler                                                |
| options       | `Object`   | The event handler options                                        |
| options.times | `number`   | Remove listener after being called the specified amount of times |

**Example**

```js
server
  .get('/session')
  .on('request', (req) => {
    req.headers['X-AUTH'] = '<ACCESS_TOKEN>';
    req.query.email = 'test@app.com';
  })
  .on('request', () => {
    /* Do something else */
  })
  .on(
    'request',
    () => {
      /* Do something else twice */
    },
    { times: 2 }
  );
```

### once

Register a one-time [event](server/events-and-middleware) handler.

?> **Tip:** You can attach multiple handlers to a single event. Handlers will be
called in the order they were declared.

| Param     | Type       | Description       |
| --------- | ---------- | ----------------- |
| eventName | `String`   | The event name    |
| handler   | `Function` | The event handler |

**Example**

```js
server
  .get('/session')
  .once('request', (req) => {
    req.headers['X-AUTH'] = '<ACCESS_TOKEN>';
    req.query.email = 'test@app.com';
  })
  .once('request', () => {
    /* Do something else */
  });
```

### off

Un-register an [event](server/events-and-middleware) handler. If no handler
is specified, all event handlers are un-registered for the given event name.

| Param     | Type       | Description       |
| --------- | ---------- | ----------------- |
| eventName | `String`   | The event name    |
| handler   | `Function` | The event handler |

**Example**

```js
const handler = () => {};

server
  .get('/session')
  .on('request', , handler)
  .on('request', () => {})
  .off('request', handler) /* Un-register the specified event/handler pair */
  .off('request'); /* Un-register all handlers */
```

### intercept

Register an intercept handler. Once set, the [request](server/request) will
never go to server but instead defer to the provided handler to handle
the [response](server/response). If multiple intercept handlers have been
registered, each handler will be called in the order in which it was registered.

| Param         | Type       | Description                                                     |
| ------------- | ---------- | --------------------------------------------------------------- |
| handler       | `Function` | The intercept handler                                           |
| options       | `Object`   | The event handler options                                       |
| options.times | `number`   | Remove handler after being called the specified amount of times |

**Example**

```js
server.any('/session').intercept((req, res) => res.sendStatus(200));

server.any('/twice').intercept((req, res) => res.sendStatus(200), { times: 2 });

server.get('/session/:id').intercept((req, res, interceptor) => {
  if (req.params.id === '1') {
    res.status(200).json({ token: 'ABC123XYZ' });
  } else if (req.params.id === '2') {
    res.status(404).json({ error: 'Unknown Session' });
  } else {
    interceptor.abort();
  }
});
```

#### Interceptor

_Extends [Event](server/event)_

The `intercept` handler receives a third `interceptor` argument that provides
some utilities.

##### abort

Calling the `abort` method on the interceptor tells the Polly instance to
continue handling the request as if it hasn't been intercepted. This allows you
to only intercept specific types of requests while opting out of others.

**Example**

```js
server.get('/session/:id').intercept((req, res, interceptor) => {
  if (req.params.id === '1') {
    res.status(200).json({ token: 'ABC123XYZ' });
  } else {
    interceptor.abort();
  }
});
```

##### passthrough

Calling the `passthrough` method on the interceptor tells the Polly instance to
continue handling the request as if it has been declared as a passthrough.
This allows you to only intercept specific types of requests while passing
others through.

**Example**

```js
server.get('/session/:id').intercept((req, res, interceptor) => {
  if (req.params.id === '1') {
    res.status(200).json({ token: 'ABC123XYZ' });
  } else {
    interceptor.passthrough();
  }
});
```

##### stopPropagation

If several intercept handlers are attached to the same route, they are called in the order in which they were added. If `stopPropagation` is invoked during one such call, no remaining handlers will be called.

**Example**

```js
// First call should return the user and not enter the 2nd handler
server
  .get('/session/:id')
  .times(1) // Remove this interceptor after it gets called once
  .intercept((req, res, interceptor) => {
    // Do not continue to the next intercept handler which handles the 404 case
    interceptor.stopPropagation();
    res.sendStatus(200);
  });

server.delete('/session/:id').intercept((req, res) => res.sendStatus(204));

// Second call should 404 since the user no longer exists
server.get('/session/:id').intercept((req, res) => res.sendStatus(404));

await fetch('/session/1'); // --> 200
await fetch('/session/1', { method: 'DELETE' }); // --> 204
await fetch('/session/1'); // --> 404
```

### passthrough

Declare a route as a passthrough meaning any request that matches that route
will directly use the native implementation. Passthrough requests will not be
recorded.

| Param       | Type      | Description                                           |
| ----------- | --------- | ----------------------------------------------------- |
| passthrough | `boolean` | Enable or disable the passthrough. Defaults to `true` |

**Example**

```js
server.any('/session').passthrough();

server.get('/session/1').passthrough(false);
```

### filter

Filter requests matched by the route handler with a predicate callback function.
This can be useful when trying to match a request by a part of the url, a header,
and/or parts of the request body.

The callback will receive the [Request](server/request)
as an argument. Return `true` to match the request, `false` otherwise.

?> Multiple filters can be chained together. They must all return `true` for the route handler to match the given request.

| Param    | Type       | Description                   |
| -------- | ---------- | ----------------------------- |
| callback | `Function` | The filter predicate function |

**Example**

```js
server
  .any()
  .filter(req => req.hasHeader('Authentication'));
  .on('request', req => {
    res.setHeader('Authentication', 'test123')
  });

server
  .get('/users/:id')
  .filter(req => req.params.id === '1');
  .intercept((req, res) => {
    res.status(200).json({ email: 'user1@test.com' });
  });
```

### times

Proceeding intercept and event handlers defined will be removed after being called the specified amount of times. The number specified is used as a default value and can be overridden by passing a custom `times` option to the handler.

| Param | Type     | Description                                                                                        |
| ----- | -------- | -------------------------------------------------------------------------------------------------- |
| times | `number` | Default times value for proceeding handlers. If no value is provided, the default value is removed |

**Example**

```js
server
  .any()
  .times(2);
  .on('request', req => {});
  .intercept((req, res) => {});
  .times()
  .on('response', (req, res) => {});

// Is the same as:

server
  .any()
  .on('request', req => {}, { times: 2 });
  .intercept((req, res) => {}, { times: 2 });
  .on('response', (req, res) => {});
```

### configure

Override configuration options for the given route. All matching middleware and route level configs are merged together and the overrides are applied to the current
Polly instance's config.

!> The following options are not supported to be overridden via the server API:
`mode`, `adapters`, `adapterOptions`, `persister`, `persisterOptions`

| Param  | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| config | `Object` | [Configuration](configuration) object |

**Example**

```js
server.any('/session').configure({ recordFailedRequests: true });

server.get('/users/:id').configure({ timing: Timing.relative(3.0) });

server.get('/users/1').configure({ logLevel: 'info' });
```

### recordingName

Override the recording name for the given route. This allows for grouping common
requests to share a single recording which can drastically help de-clutter test
recordings.

For example, if your tests always make a `/users` or `/session` call, instead of
having each of those requests be recorded for every single test, you can use
this to create a common recording file for them.

| Param         | Type     | Description                                                               |
| ------------- | -------- | ------------------------------------------------------------------------- |
| recordingName | `String` | Name of the [recording](api#recordingName) to store the recordings under. |

**Example**

```js
server.any('/session').recordingName('User Session');

server.get('/users/:id').recordingName('User Data');

server
  .get('/users/1')
  .recordingName(); /* Fallback to the polly instance's recording name */
```


================================================
FILE: docs/test-frameworks/jest-jasmine.md
================================================
# Jest & Jasmine

Due to the nature of the Jest & Jasmine APIs and their restrictions on accessing
the current running test and its parent modules, we've decided to keep this test helper
as a 3rd party library provided by [@gribnoysup](https://github.com/gribnoysup).

The [setup-polly-jest](https://github.com/gribnoysup/setup-polly-jest) package provides a `setupPolly` utility which will setup a new polly instance for each test as well as stop it once the test has ended.
The Polly instance's recording name is derived from the current test name as well as its
parent module(s).

[README.md](https://raw.githubusercontent.com/gribnoysup/setup-polly-jest/master/README.md ':include :type=markdown')


================================================
FILE: docs/test-frameworks/mocha.md
================================================
# Mocha

The `@pollyjs/core` package provides a `setupMocha` utility which will setup
a new polly instance for each test as well as stop it once the test has ended.
The Polly instance's recording name is derived from the current test name as well as its
parent module(s).

| Param  | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| config | `Object` | [Configuration](configuration) object |

## Usage

### Simple Example {docsify-ignore}

```js
import { setupMocha as setupPolly } from '@pollyjs/core';

describe('Netflix Homepage', function() {
  setupPolly({
    /* default configuration options */
  });

  it('should be able to sign in', async function() {
    /*
      The setupPolly test helper creates a new polly instance which you can
      access via `this.polly`. The recording name is generated based on the module
      and test names.
    */
    this.polly.configure({ recordIfMissing: false });

    /* start: pseudo test code */
    await visit('/login');
    await fillIn('email', 'polly@netflix.com');
    await fillIn('password', '@pollyjs');
    await submit();
    /* end: pseudo test code */

    expect(location.pathname).to.equal('/browse');

    /*
      The setupPolly test helper will call `this.polly.stop()` when your test
      has finished.
    */
  });
});
```

### Intercept Example {docsify-ignore}

```js
import { setupMocha as setupPolly } from '@pollyjs/core';

describe('module', function() {
  setupPolly();

  it('does a thing', function() {
    const { server } = this.polly;

    server
      .get('/ping')
      .intercept((req, res) => res.sendStatus(200));

    expect((await fetch('/ping').status).to.equal(200);
  });
});
```

## Test Hook Ordering

Accessing `this.polly` during a test run after the polly instance has been
stopped and destroyed produces the following error:

!> _You are trying to access an instance of Polly that is no longer available._

If you need to do some work before the polly instance gets destroyed or just need more control on when each of the test hooks are called, `setupMocha` can be invoked as a function or accessed as an object with two methods: `setupMocha.beforeEach` and `setupMocha.afterEach`.

Instead of calling `setupMocha()`, register these two hooks separately in the order that fits within your test.

```js
import { setupMocha as setupPolly } from '@pollyjs/core';

describe('Netflix Homepage', function() {
  setupPolly.beforeEach({
    /* default configuration options */
  });

  afterEach(function() {
    /* do something before the polly instance is destroyed... */
  });

  setupPolly.afterEach();

  it('should be able to sign in', async function() {
    /* ... */
  });
});
```

## Configuring ember-mocha

If you're using [`ember-mocha`](https://github.com/emberjs/ember-mocha) be sure to use their built-in
[hooks API](https://github.com/emberjs/ember-mocha#setup-tests).  Otherwise, Polly's mocha test helper will be unable to teardown Polly between tests.

An example of how to correctly setup Polly with `ember-mocha`:

```js
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupApplicationTest } from 'ember-mocha';
import { visit, currentURL } from '@ember/test-helpers';
import { setupMocha as setupPolly } from '@pollyjs/core';

describe('Acceptance | Home', function() {
  const hooks = setupApplicationTest();
  setupPolly(
    {
      /* optional config */
    },
    hooks
  );

  it('can visit /', async function() {
    await visit('/');
    expect(currentURL()).to.equal('/');
  });
});
```


================================================
FILE: docs/test-frameworks/qunit.md
================================================
# QUnit

The `@pollyjs/core` package provides a `setupQunit` utility which will setup
a new polly instance for each test as well as stop it once the test has ended.
The Polly instance's recording name is derived from the current test name as well as its
parent module(s).

| Param  | Type     | Description                           |
| ------ | -------- | ------------------------------------- |
| hooks  | `Object` | QUnit hooks object                    |
| config | `Object` | [Configuration](configuration) object |

## Usage

### Simple Example {docsify-ignore}

```js
import { setupQunit as setupPolly } from '@pollyjs/core';

module('Netflix Homepage', function(hooks) {
  setupPolly(hooks, {
    /* default configuration options */
  });

  test('should be able to sign in', async function(assert) {
    /*
      The setupPolly test helper creates a new polly instance which you can
      access via `this.polly`. The recording name is generated based on the module
      and test names.
    */
    this.polly.configure({ recordIfMissing: false });

    /* start: pseudo test code */
    await visit('/login');
    await fillIn('email', 'polly@netflix.com');
    await fillIn('password', '@pollyjs');
    await submit();
    /* end: pseudo test code */

    assert.equal(location.pathname, '/browse');

    /*
      The setupPolly test helper will call `this.polly.stop()` when your test
      has finished.
    */
  });
});
```

### Intercept Example {docsify-ignore}

```js
import { setupQunit as setupPolly } from '@pollyjs/core';

module('module', function(hooks) {
  setupPolly(hooks);

  test('does a thing', function(assert) {
    const { server } = this.polly;

    server
      .get('/ping')
      .intercept((req, res) => res.sendStatus(200));

    assert.equal((await fetch('/ping').status, 200);
  });
});
```

## Test Hook Ordering

Accessing `this.polly` during a test run after the polly instance has been
stopped and destroyed produces the following error:

!> _You are trying to access an instance of Polly that is no longer available._

If you need to do some work before the polly instance gets destroyed or just need more control on when each of the test hooks are called, `setupQunit` can be invoked as a function or accessed as an object with two methods: `setupQunit.beforeEach` and `setupQunit.afterEach`.

Instead of calling `setupQunit()`, register these two hooks separately in the order that fits within your test.

```js
import { setupQunit as setupPolly } from '@pollyjs/core';

module('Netflix Homepage', function(hooks) {
  setupPolly.beforeEach(hooks, {
    /* default configuration options */
  });

  hooks.afterEach(function() {
    /* do something before the polly instance is destroyed... */
  });

  setupPolly.afterEach(hooks);

  test('should be able to sign in', async function() {
    /* ... */
  });
});
```


================================================
FILE: examples/.eslintrc.js
================================================
module.exports = {
  env: {
    node: true,
    browser: true
  }
};


================================================
FILE: examples/client-server/index.html
================================================
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Client Server Tests</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      rel="stylesheet"
      type="text/css"
      href="./node_modules/mocha/mocha.css"
    />
  </head>
  <body>
    <div id="mocha"></div>

    <script src="./node_modules/mocha/mocha.js"></script>
    <script src="./node_modules/chai/chai.js"></script>
    <script src="./node_modules/@pollyjs/core/dist/umd/pollyjs-core.js"></script>
    <script src="./node_modules/@pollyjs/adapter-fetch/dist/umd/pollyjs-adapter-fetch.js"></script>
    <script src="./node_modules/@pollyjs/persister-local-storage/dist/umd/pollyjs-persister-local-storage.js"></script>

    <script src="./tests/setup.js"></script>
    <script src="./tests/intercept.test.js"></script>
    <script src="./tests/events.test.js"></script>

    <script>
      mocha.checkLeaks();
      mocha.run();
    </script>
  </body>
</html>


================================================
FILE: examples/client-server/package.json
================================================
{
  "name": "@pollyjs/client-server-example",
  "version": "0.1.0",
  "private": true,
  "license": "Apache-2.0",
  "scripts": {
    "test": "http-server -p 3000 -o -c-1 -s"
  },
  "devDependencies": {
    "@pollyjs/adapter-fetch": "*",
    "@pollyjs/core": "*",
    "@pollyjs/persister-local-storage": "*",
    "chai": "*",
    "http-server": "*",
    "mocha": "*"
  }
}


================================================
FILE: examples/client-server/tests/events.test.js
================================================
/* global setupPolly */

describe('Events', function () {
  setupPolly({
    adapters: ['fetch'],
    persister: 'local-storage'
  });

  it('can help test dynamic data', async function () {
    const { server } = this.polly;
    let numPosts = 0;

    server
      .get('https://jsonplaceholder.typicode.com/posts')
      .on('response', (_, res) => {
        numPosts = res.jsonBody().length;
      });

    const res = await fetch('https://jsonplaceholder.typicode.com/posts');
    const posts = await res.json();

    expect(res.status).to.equal(200);
    expect(posts.length).to.equal(numPosts);
  });
});


================================================
FILE: examples/client-server/tests/intercept.test.js
================================================
/* global setupPolly */

describe('Intercept', function () {
  setupPolly({
    adapters: ['fetch'],
    persister: 'local-storage'
  });

  it('can mock valid responses', async function () {
    const { server } = this.polly;

    server
      .get('https://jsonplaceholder.typicode.com/posts/:id')
      .intercept((req, res) => {
        res.status(200).json({
          id: Number(req.params.id),
          title: `Post ${req.params.id}`
        });
      });

    const res = await fetch('https://jsonplaceholder.typicode.com/posts/42');
    const post = await res.json();

    expect(res.status).to.equal(200);
    expect(post.id).to.equal(42);
    expect(post.title).to.equal('Post 42');
  });

  it('can mock invalid responses', async function () {
    const { server } = this.polly;

    server
      .get('https://jsonplaceholder.typicode.com/posts/404')
      .intercept((_, res) => {
        res.status(404).send('Post not found.');
      });

    const res = await fetch('https://jsonplaceholder.typicode.com/posts/404');
    const text = await res.text();

    expect(res.status).to.equal(404);
    expect(text).to.equal('Post not found.');
  });

  it('can conditionally intercept requests', async function () {
    const { server } = this.polly;

    server
      .get('https://jsonplaceholder.typicode.com/posts/:id')
      .intercept((req, res, interceptor) => {
        if (req.params.id === '42') {
          res.status(200).send('Life');
        } else {
          // Abort out of the intercept handler and continue with the request
          interceptor.abort();
        }
      });

    let res = await fetch('https://jsonplaceholder.typicode.com/posts/42');

    expect(res.status).to.equal(200);
    expect(await res.text()).to.equal('Life');

    res = await fetch('https://jsonplaceholder.typicode.com/posts/1');

    expect(res.status).to.equal(200);
    expect((await res.json()).id).to.equal(1);
  });
});


================================================
FILE: examples/client-server/tests/setup.js
================================================
// Expose common globals
window.PollyJS = window['@pollyjs/core'];
window.setupPolly = window.PollyJS.setupMocha;
window.expect = window.chai.expect;

// Register the fetch adapter and local-storage persister
window.PollyJS.Polly.register(window['@pollyjs/adapter-fetch']);
window.PollyJS.Polly.register(window['@pollyjs/persister-local-storage']);

// Setup Mocha
mocha.setup({ ui: 'bdd', noHighlighting: true });


================================================
FILE: examples/dummy-app/.eslintrc.js
================================================
module.exports = {
  extends: ['plugin:react/recommended'],
  settings: {
    react: {
      version: '16.5.1'
    }
  }
};


================================================
FILE: examples/dummy-app/.gitignore
================================================
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*


================================================
FILE: examples/dummy-app/README.md
================================================
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).

Below you will find some information on how to perform common tasks.<br>
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).

## Table of Contents

- [Updating to New Releases](#updating-to-new-releases)
- [Sending Feedback](#sending-feedback)
- [Folder Structure](#folder-structure)
- [Available Scripts](#available-scripts)
  - [npm start](#npm-start)
  - [npm test](#npm-test)
  - [npm run build](#npm-run-build)
  - [npm run eject](#npm-run-eject)
- [Supported Browsers](#supported-browsers)
- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)
- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)
- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)
- [Debugging in the Editor](#debugging-in-the-editor)
- [Formatting Code Automatically](#formatting-code-automatically)
- [Changing the Page `<title>`](#changing-the-page-title)
- [Installing a Dependency](#installing-a-dependency)
- [Importing a Component](#importing-a-component)
- [Code Splitting](#code-splitting)
- [Adding a Stylesheet](#adding-a-stylesheet)
- [Post-Processing CSS](#post-processing-css)
- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc)
- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files)
- [Using the `public` Folder](#using-the-public-folder)
  - [Changing the HTML](#changing-the-html)
  - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system)
  - [When to Use the `public` Folder](#when-to-use-the-public-folder)
- [Using Global Variables](#using-global-variables)
- [Adding Bootstrap](#adding-bootstrap)
  - [Using a Custom Theme](#using-a-custom-theme)
- [Adding Flow](#adding-flow)
- [Adding a Router](#adding-a-router)
- [Adding Custom Environment Variables](#adding-custom-environment-variables)
  - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)
  - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell)
  - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env)
- [Can I Use Decorators?](#can-i-use-decorators)
- [Fetching Data with AJAX Requests](#fetching-data-with-ajax-requests)
- [Integrating with an API Backend](#integrating-with-an-api-backend)
  - [Node](#node)
  - [Ruby on Rails](#ruby-on-rails)
- [Proxying API Requests in Development](#proxying-api-requests-in-development)
  - ["Invalid Host Header" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy)
  - [Configuring the Proxy Manually](#configuring-the-proxy-manually)
  - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy)
- [Using HTTPS in Development](#using-https-in-development)
- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server)
- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files)
- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page)
- [Running Tests](#running-tests)
  - [Filename Conventions](#filename-conventions)
  - [Command Line Interface](#command-line-interface)
  - [Version Control Integration](#version-control-integration)
  - [Writing Tests](#writing-tests)
  - [Testing Components](#testing-components)
  - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries)
  - [Initializing Test Environment](#initializing-test-environment)
  - [Focusing and Excluding Tests](#focusing-and-excluding-tests)
  - [Coverage Reporting](#coverage-reporting)
  - [Continuous Integration](#continuous-integration)
  - [Disabling jsdom](#disabling-jsdom)
  - [Snapshot Testing](#snapshot-testing)
  - [Editor Integration](#editor-integration)
- [Debugging Tests](#debugging-tests)
  - [Debugging Tests in Chrome](#debugging-tests-in-chrome)
  - [Debugging Tests in Visual Studio Code](#debugging-tests-in-visual-studio-code)
- [Developing Components in Isolation](#developing-components-in-isolation)
  - [Getting Started with Storybook](#getting-started-with-storybook)
  - [Getting Started with Styleguidist](#getting-started-with-styleguidist)
- [Publishing Components to npm](#publishing-components-to-npm)
- [Making a Progressive Web App](#making-a-progressive-web-app)
  - [Opting Out of Caching](#opting-out-of-caching)
  - [Offline-First Considerations](#offline-first-considerations)
  - [Progressive Web App Metadata](#progressive-web-app-metadata)
- [Analyzing the Bundle Size](#analyzing-the-bundle-size)
- [Deployment](#deployment)
  - [Static Server](#static-server)
  - [Other Solutions](#other-solutions)
  - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)
  - [Building for Relative Paths](#building-for-relative-paths)
  - [Azure](#azure)
  - [Firebase](#firebase)
  - [GitHub Pages](#github-pages)
  - [Heroku](#heroku)
  - [Netlify](#netlify)
  - [Now](#now)
  - [S3 and CloudFront](#s3-and-cloudfront)
  - [Surge](#surge)
- [Advanced Configuration](#advanced-configuration)
- [Troubleshooting](#troubleshooting)
  - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes)
  - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra)
  - [`npm run build` exits too early](#npm-run-build-exits-too-early)
  - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)
  - [`npm run build` fails to minify](#npm-run-build-fails-to-minify)
  - [Moment.js locales are missing](#momentjs-locales-are-missing)
- [Alternatives to Ejecting](#alternatives-to-ejecting)
- [Something Missing?](#something-missing)

## Updating to New Releases

Create React App is divided into two packages:

- `create-react-app` is a global command-line utility that you use to create new projects.
- `react-scripts` is a development dependency in the generated projects (including this one).

You almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`.

When you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically.

To update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions.

In most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes.

We commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly.

## Sending Feedback

We are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues).

## Folder Structure

After creation, your project should look like this:

```
my-app/
  README.md
  node_modules/
  package.json
  public/
    index.html
    favicon.ico
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg
```

For the project to build, **these files must exist with exact filenames**:

- `public/index.html` is the page template;
- `src/index.js` is the JavaScript entry point.

You can delete or rename the other files.

You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br>
You need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them.

Only files inside `public` can be used from `public/index.html`.<br>
Read instructions below for using assets from JavaScript and HTML.

You can, however, create more top-level directories.<br>
They will not be included in the production build so you can use them for things like documentation.

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](#running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](#deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Supported Browsers

By default, the generated project uses the latest version of React.

You can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers.

## Supported Language Features and Polyfills

This project supports a superset of the latest JavaScript standard.<br>
In addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports:

- [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016).
- [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017).
- [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal).
- [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal)
- [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (part of stage 3 proposal).
- [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax.

Learn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-).

While we recommend using experimental proposals with some caution, Facebook heavily uses these features in the product code, so we intend to provide [codemods](https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb) if any of these proposals change in the future.

Note that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**:

- [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign).
- [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise).
- [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch).

If you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are including the appropriate polyfills manually, or that the browsers you are targeting already support them.

Also note that using some newer syntax features like `for...of` or `[...nonArrayValue]` causes Babel to emit code that depends on ES6 runtime features and might not work without a polyfill. When in doubt, use [Babel REPL](https://babeljs.io/repl/) to see what any specific syntax compiles down to.

## Syntax Highlighting in the Editor

To configure the syntax highlighting in your favorite text editor, head to the [relevant Babel documentation page](https://babeljs.io/docs/editors) and follow the instructions. Some of the most popular editors are covered.

## Displaying Lint Output in the Editor

> Note: this feature is available with `react-scripts@0.2.0` and higher.<br>
> It also only works with npm 3 or higher.

Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.

They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.

You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root:

```js
{
  "extends": "react-app"
}
```

Now your editor should report the linting warnings.

Note that even if you edit your `.eslintrc` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.

If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.

## Debugging in the Editor

**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**

Visual Studio Code and WebStorm support debugging out of the box with Create React App. This enables you as a developer to write and debug your React code without leaving the editor, and most importantly it enables you to have a continuous development workflow, where context switching is minimal, as you don’t have to switch between tools.

### Visual Studio Code

You would need to have the latest version of [VS Code](https://code.visualstudio.com) and VS Code [Chrome Debugger Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) installed.

Then add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory.

```json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Chrome",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceRoot}/src",
      "sourceMapPathOverrides": {
        "webpack:///src/*": "${webRoot}/*"
      }
    }
  ]
}
```

> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).

Start your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor.

Having problems with VS Code Debugging? Please see their [troubleshooting guide](https://github.com/Microsoft/vscode-chrome-debug/blob/master/README.md#troubleshooting).

### WebStorm

You would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetBrains IDE Support](https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji) Chrome extension installed.

In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration.

> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).

Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm.

The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.

## Formatting Code Automatically

Prettier is an opinionated code formatter with support for JavaScript, CSS and JSON. With Prettier you can format the code you write automatically to ensure a code style within your project. See the [Prettier's GitHub page](https://github.com/prettier/prettier) for more information, and look at this [page to see it in action](https://prettier.github.io/prettier/).

To format our code whenever we make a commit in git, we need to install the following dependencies:

```sh
npm install --save husky lint-staged prettier
```

Alternatively you may use `yarn`:

```sh
yarn add husky lint-staged prettier
```

- `husky` makes it easy to use githooks as if they are npm scripts.
- `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8).
- `prettier` is the JavaScript formatter we will run before commits.

Now we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root.

Add the following line to `scripts` section:

```diff
  "scripts": {
+   "precommit": "lint-staged",
    "start": "react-scripts start",
    "build": "react-scripts build",
```

Next we add a 'lint-staged' field to the `package.json`, for example:

```diff
  "dependencies": {
    // ...
  },
+ "lint-staged": {
+   "src/**/*.{js,jsx,json,css}": [
+     "prettier --single-quote --write",
+     "git add"
+   ]
+ },
  "scripts": {
```

Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write "src/**/*.{js,jsx,json,css}"` to format your entire project for the first time.

Next you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://prettier.io/docs/en/editors.html) on the Prettier GitHub page.

## Changing the Page `<title>`

You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else.

Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML.

If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library.

If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](#pre-rendering-into-static-html-files).

## Installing a Dependency

The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`:

```sh
npm install --save react-router
```

Alternatively you may use `yarn`:

```sh
yarn add react-router
```

This works for any library, not just `react-router`.

## Importing a Component

This project setup supports ES6 modules thanks to Babel.<br>
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.

For example:

### `Button.js`

```js
import React, { Component } from 'react';

class Button extends Component {
  render() {
    // ...
  }
}

export default Button; // Don’t forget to use export default!
```

### `DangerButton.js`

```js
import React, { Component } from 'react';
import Button from './Button'; // Import a component from another file

class DangerButton extends Component {
  render() {
    return <Button color="red" />;
  }
}

export default DangerButton;
```

Be aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes.

We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`.

Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.

Learn more about ES6 modules:

- [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281)
- [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html)
- [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules)

## Code Splitting

Instead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand.

This project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module.

Here is an example:

### `moduleA.js`

```js
const moduleA = 'Hello';

export { moduleA };
```

### `App.js`

```js
import React, { Component } from 'react';

class App extends Component {
  handleClick = () => {
    import('./moduleA')
      .then(({ moduleA }) => {
        // Use moduleA
      })
      .catch(err => {
        // Handle failure
      });
  };

  render() {
    return (
    
Download .txt
gitextract_9hhv16l2/

├── .commitlintrc.js
├── .eslintignore
├── .eslintrc.js
├── .github/
│   ├── issue_template.md
│   └── pull_request_template.md
├── .gitignore
├── .husky/
│   ├── commit-msg
│   └── pre-commit
├── .mocharc.js
├── .prettierrc.js
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── OSSMETADATA
├── README.md
├── docs/
│   ├── .nojekyll
│   ├── _coverpage.md
│   ├── _sidebar.md
│   ├── adapters/
│   │   ├── custom.md
│   │   ├── fetch.md
│   │   ├── node-http.md
│   │   ├── playwright.md
│   │   ├── puppeteer.md
│   │   └── xhr.md
│   ├── api.md
│   ├── assets/
│   │   └── styles.css
│   ├── cli/
│   │   ├── commands.md
│   │   └── overview.md
│   ├── configuration.md
│   ├── examples.md
│   ├── frameworks/
│   │   └── ember-cli.md
│   ├── index.html
│   ├── node-server/
│   │   ├── express-integrations.md
│   │   └── overview.md
│   ├── persisters/
│   │   ├── custom.md
│   │   ├── fs.md
│   │   ├── local-storage.md
│   │   └── rest.md
│   ├── quick-start.md
│   ├── server/
│   │   ├── api.md
│   │   ├── event.md
│   │   ├── events-and-middleware.md
│   │   ├── overview.md
│   │   ├── request.md
│   │   ├── response.md
│   │   └── route-handler.md
│   └── test-frameworks/
│       ├── jest-jasmine.md
│       ├── mocha.md
│       └── qunit.md
├── examples/
│   ├── .eslintrc.js
│   ├── client-server/
│   │   ├── index.html
│   │   ├── package.json
│   │   └── tests/
│   │       ├── events.test.js
│   │       ├── intercept.test.js
│   │       └── setup.js
│   ├── dummy-app/
│   │   ├── .eslintrc.js
│   │   ├── .gitignore
│   │   ├── README.md
│   │   ├── package.json
│   │   ├── public/
│   │   │   ├── index.html
│   │   │   └── manifest.json
│   │   └── src/
│   │       ├── App.js
│   │       ├── index.css
│   │       ├── index.js
│   │       ├── posts.js
│   │       ├── todos.js
│   │       └── users.js
│   ├── jest-node-fetch/
│   │   ├── .eslintrc.js
│   │   ├── __recordings__/
│   │   │   └── jest-node-fetch_1142061259/
│   │   │       ├── posts_1278140380/
│   │   │       │   └── should-return-post_148615714/
│   │   │       │       └── recording.har
│   │   │       └── users_1585235219/
│   │   │           └── should-return-user_4259424139/
│   │   │               └── recording.har
│   │   ├── __tests__/
│   │   │   └── index.test.js
│   │   ├── package.json
│   │   └── src/
│   │       ├── index.js
│   │       ├── posts.js
│   │       └── users.js
│   ├── jest-puppeteer/
│   │   ├── .eslintrc.js
│   │   ├── __recordings__/
│   │   │   └── jest-puppeteer_2726822272/
│   │   │       └── should-be-able-to-navigate-to-all-routes_1130491217/
│   │   │           └── recording.har
│   │   ├── __tests__/
│   │   │   └── dummy-app.test.js
│   │   ├── jest-puppeteer.config.js
│   │   ├── jest.config.js
│   │   └── package.json
│   ├── node-fetch/
│   │   ├── package.json
│   │   ├── recordings/
│   │   │   └── node-fetch_2851505768/
│   │   │       └── should-work_3457346403/
│   │   │           └── recording.har
│   │   └── tests/
│   │       └── node-fetch.test.js
│   ├── puppeteer/
│   │   ├── index.js
│   │   ├── package.json
│   │   └── recordings/
│   │       └── puppeteer_2155046665/
│   │           └── recording.har
│   ├── rest-persister/
│   │   ├── index.html
│   │   ├── package.json
│   │   ├── recordings/
│   │   │   └── REST-Persister_2289553200/
│   │   │       └── should-work_3457346403/
│   │   │           └── recording.har
│   │   └── tests/
│   │       ├── rest-persister.test.js
│   │       └── setup.js
│   └── typescript-jest-node-fetch/
│       ├── __recordings__/
│       │   └── github-api-client_2139812550/
│       │       └── getUser_1648904580/
│       │           └── recording.har
│       ├── jest.config.ts
│       ├── package.json
│       ├── src/
│       │   ├── github-api.test.ts
│       │   ├── github-api.ts
│       │   └── utils/
│       │       └── auto-setup-polly.ts
│       └── tsconfig.json
├── jest.config.js
├── lerna.json
├── package.json
├── packages/
│   └── @pollyjs/
│       ├── adapter/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── dehumanize-time.js
│       │   │       ├── is-expired.js
│       │   │       ├── normalize-recorded-response.js
│       │   │       └── stringify-request.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── adapter-test.js
│       │   │       └── utils/
│       │   │           ├── dehumanize-time-test.js
│       │   │           └── is-expired-test.js
│       │   └── types.d.ts
│       ├── adapter-fetch/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       └── serializer-headers.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   ├── adapter-test.js
│       │   │   │   ├── persister-local-storage-test.js
│       │   │   │   ├── persister-rest-test.js
│       │   │   │   └── server-test.js
│       │   │   └── utils/
│       │   │       └── polly-config.js
│       │   └── types.d.ts
│       ├── adapter-node-http/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.shared.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── get-url-from-options.js
│       │   │       ├── merge-chunks.js
│       │   │       └── url-to-options.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   ├── adapter-node-fetch-test.js
│       │   │   │   ├── adapter-test.js
│       │   │   │   └── persister-fs-test.js
│       │   │   ├── jest/
│       │   │   │   └── integration/
│       │   │   │       ├── fetch-test.js
│       │   │   │       └── xhr-test.js
│       │   │   ├── unit/
│       │   │   │   └── utils/
│       │   │   │       └── merge-chunks-test.js
│       │   │   └── utils/
│       │   │       ├── get-buffer-from-stream.js
│       │   │       ├── get-response-from-request.js
│       │   │       ├── native-request.js
│       │   │       └── polly-config.js
│       │   └── types.d.ts
│       ├── adapter-puppeteer/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   ├── helpers/
│       │   │   │   └── fetch.js
│       │   │   ├── integration/
│       │   │   │   └── adapter-test.js
│       │   │   └── unit/
│       │   │       └── adapter-test.js
│       │   └── types.d.ts
│       ├── adapter-xhr/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── index.js
│       │   │   └── utils/
│       │   │       ├── resolve-xhr.js
│       │   │       └── serialize-response-headers.js
│       │   ├── tests/
│       │   │   ├── integration/
│       │   │   │   └── adapter-test.js
│       │   │   └── utils/
│       │   │       └── xhr-request.js
│       │   └── types.d.ts
│       ├── cli/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── bin/
│       │   │   └── cli.js
│       │   └── package.json
│       ├── core/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── -private/
│       │   │   │   ├── container.js
│       │   │   │   ├── event-emitter.js
│       │   │   │   ├── event.js
│       │   │   │   ├── http-base.js
│       │   │   │   ├── interceptor.js
│       │   │   │   ├── logger.js
│       │   │   │   ├── request.js
│       │   │   │   └── response.js
│       │   │   ├── defaults/
│       │   │   │   └── config.js
│       │   │   ├── index.js
│       │   │   ├── polly.js
│       │   │   ├── server/
│       │   │   │   ├── handler.js
│       │   │   │   ├── index.js
│       │   │   │   ├── middleware.js
│       │   │   │   └── route.js
│       │   │   ├── test-helpers/
│       │   │   │   ├── lib.js
│       │   │   │   ├── mocha.js
│       │   │   │   └── qunit.js
│       │   │   └── utils/
│       │   │       ├── cancel-fn-after-n-times.js
│       │   │       ├── deferred-promise.js
│       │   │       ├── guid-for-recording.js
│       │   │       ├── http-headers.js
│       │   │       ├── merge-configs.js
│       │   │       ├── normalize-request.js
│       │   │       ├── parse-url.js
│       │   │       ├── remove-host-from-url.js
│       │   │       ├── timing.js
│       │   │       └── validators.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── -private/
│       │   │       │   ├── container-test.js
│       │   │       │   ├── event-emitter-test.js
│       │   │       │   ├── event-test.js
│       │   │       │   ├── http-base-test.js
│       │   │       │   ├── interceptor-test.js
│       │   │       │   └── response-test.js
│       │   │       ├── index-test.js
│       │   │       ├── polly-test.js
│       │   │       ├── server/
│       │   │       │   ├── handler-test.js
│       │   │       │   └── server-test.js
│       │   │       ├── test-helpers/
│       │   │       │   └── mocha-test.js
│       │   │       └── utils/
│       │   │           ├── deferred-promise-test.js
│       │   │           ├── guid-for-recording-test.js
│       │   │           ├── http-headers-test.js
│       │   │           ├── merge-configs-test.js
│       │   │           ├── normalize-request-test.js
│       │   │           ├── parse-url-test.js
│       │   │           ├── remove-host-from-url-test.js
│       │   │           └── timing-test.js
│       │   └── types.d.ts
│       ├── ember/
│       │   ├── .editorconfig
│       │   ├── .ember-cli
│       │   ├── .eslintignore
│       │   ├── .eslintrc.js
│       │   ├── .gitignore
│       │   ├── .npmignore
│       │   ├── .prettierignore
│       │   ├── .prettierrc.js
│       │   ├── .template-lintrc.js
│       │   ├── .watchmanconfig
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── addon/
│       │   │   └── -private/
│       │   │       └── preconfigure.js
│       │   ├── blueprints/
│       │   │   └── @pollyjs/
│       │   │       └── ember/
│       │   │           ├── files/
│       │   │           │   └── config/
│       │   │           │       └── polly.js
│       │   │           └── index.js
│       │   ├── config/
│       │   │   ├── ember-try.js
│       │   │   ├── environment.js
│       │   │   └── polly.js
│       │   ├── ember-cli-build.js
│       │   ├── index.js
│       │   ├── package.json
│       │   ├── testem.js
│       │   ├── tests/
│       │   │   ├── dummy/
│       │   │   │   ├── app/
│       │   │   │   │   ├── app.js
│       │   │   │   │   ├── components/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── controllers/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── helpers/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── index.html
│       │   │   │   │   ├── models/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── router.js
│       │   │   │   │   ├── routes/
│       │   │   │   │   │   └── .gitkeep
│       │   │   │   │   ├── styles/
│       │   │   │   │   │   └── app.css
│       │   │   │   │   └── templates/
│       │   │   │   │       └── application.hbs
│       │   │   │   ├── config/
│       │   │   │   │   ├── ember-cli-update.json
│       │   │   │   │   ├── environment.js
│       │   │   │   │   ├── optional-features.json
│       │   │   │   │   └── targets.js
│       │   │   │   └── public/
│       │   │   │       └── robots.txt
│       │   │   ├── helpers/
│       │   │   │   └── .gitkeep
│       │   │   ├── index.html
│       │   │   ├── integration/
│       │   │   │   └── .gitkeep
│       │   │   ├── test-helper.js
│       │   │   └── unit/
│       │   │       └── polly-test.js
│       │   └── vendor/
│       │       └── .gitkeep
│       ├── node-server/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── src/
│       │   │   ├── api.js
│       │   │   ├── config.js
│       │   │   ├── express/
│       │   │   │   └── register-api.js
│       │   │   ├── index.js
│       │   │   └── server.js
│       │   └── types.d.ts
│       ├── persister/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── har/
│       │   │   │   ├── entry.js
│       │   │   │   ├── index.js
│       │   │   │   ├── log.js
│       │   │   │   ├── request.js
│       │   │   │   ├── response.js
│       │   │   │   └── utils/
│       │   │   │       ├── get-first-header.js
│       │   │   │       └── to-nv-pairs.js
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       ├── har-test.js
│       │   │       └── persister-test.js
│       │   └── types.d.ts
│       ├── persister-fs/
│       │   ├── .eslintrc.js
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.js
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   ├── tests/
│       │   │   └── unit/
│       │   │       └── persister-test.js
│       │   └── types.d.ts
│       ├── persister-in-memory/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   └── types.d.ts
│       ├── persister-local-storage/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   └── index.js
│       │   └── types.d.ts
│       ├── persister-rest/
│       │   ├── CHANGELOG.md
│       │   ├── LICENSE
│       │   ├── README.md
│       │   ├── package.json
│       │   ├── rollup.config.test.js
│       │   ├── src/
│       │   │   ├── ajax.js
│       │   │   └── index.js
│       │   └── types.d.ts
│       └── utils/
│           ├── CHANGELOG.md
│           ├── LICENSE
│           ├── README.md
│           ├── package.json
│           ├── rollup.config.test.js
│           ├── src/
│           │   ├── constants/
│           │   │   ├── actions.js
│           │   │   ├── expiry-strategies.js
│           │   │   ├── http-methods.js
│           │   │   ├── http-status-codes.js
│           │   │   └── modes.js
│           │   ├── index.js
│           │   └── utils/
│           │       ├── assert.js
│           │       ├── build-url.js
│           │       ├── clone-arraybuffer.js
│           │       ├── is-buffer-utf8-representable.js
│           │       ├── polly-error.js
│           │       ├── serializers/
│           │       │   ├── blob.js
│           │       │   ├── buffer.js
│           │       │   ├── form-data.js
│           │       │   └── index.js
│           │       ├── timeout.js
│           │       ├── timestamp.js
│           │       └── url.js
│           ├── tests/
│           │   ├── browser/
│           │   │   └── unit/
│           │   │       └── utils/
│           │   │           └── serializers/
│           │   │               ├── blob.js
│           │   │               └── form-data.js
│           │   ├── node/
│           │   │   └── unit/
│           │   │       └── utils/
│           │   │           └── serializers/
│           │   │               └── buffer.js
│           │   ├── serializer-tests.js
│           │   └── unit/
│           │       └── utils/
│           │           ├── assert-test.js
│           │           ├── build-url-test.js
│           │           ├── polly-error-test.js
│           │           ├── timeout-test.js
│           │           ├── timestamp-test.js
│           │           └── url-test.js
│           └── types.d.ts
├── scripts/
│   ├── require-clean-work-tree.sh
│   ├── require-test-build.sh
│   └── rollup/
│       ├── browser.config.js
│       ├── browser.test.config.js
│       ├── default.config.js
│       ├── jest.test.config.js
│       ├── node.config.js
│       ├── node.test.config.js
│       └── utils.js
├── testem.js
└── tests/
    ├── helpers/
    │   ├── file.js
    │   ├── global-node-fetch.js
    │   ├── setup-fetch-record.js
    │   └── setup-persister.js
    ├── index.mustache
    ├── integration/
    │   ├── adapter-browser-tests.js
    │   ├── adapter-identifier-tests.js
    │   ├── adapter-node-tests.js
    │   ├── adapter-polly-tests.js
    │   ├── adapter-tests.js
    │   └── persister-tests.js
    ├── middleware.js
    └── node-setup.js
Download .txt
SYMBOL INDEX (585 symbols across 120 files)

FILE: examples/typescript-jest-node-fetch/src/github-api.ts
  function checkErrorAndReturnJson (line 14) | function checkErrorAndReturnJson(response: Response) {

FILE: examples/typescript-jest-node-fetch/src/utils/auto-setup-polly.ts
  function autoSetupPolly (line 26) | function autoSetupPolly() {

FILE: packages/@pollyjs/adapter-fetch/src/index.js
  constant IS_STUBBED (line 9) | const IS_STUBBED = Symbol();
  constant ABORT_HANDLER (line 10) | const ABORT_HANDLER = Symbol();
  constant REQUEST_ARGUMENTS (line 11) | const REQUEST_ARGUMENTS = Symbol();
  class FetchAdapter (line 13) | class FetchAdapter extends Adapter {
    method id (line 14) | static get id() {
    method defaultOptions (line 18) | get defaultOptions() {
    method onConnect (line 24) | onConnect() {
    method onDisconnect (line 118) | onDisconnect() {
    method onRequest (line 128) | onRequest(pollyRequest) {
    method onFetchResponse (line 143) | async onFetchResponse(pollyRequest) {
    method onRespond (line 185) | onRespond(pollyRequest, error) {

FILE: packages/@pollyjs/adapter-fetch/src/utils/serializer-headers.js
  function serializeHeaders (line 5) | function serializeHeaders(headers) {

FILE: packages/@pollyjs/adapter-fetch/tests/integration/adapter-test.js
  class MockRequest (line 13) | class MockRequest {}
  class MockResponse (line 14) | class MockResponse {}
  class MockHeaders (line 15) | class MockHeaders {}
  function testRequestOptions (line 179) | function testRequestOptions(createRequest, options) {
  method fetch (line 310) | fetch() {}
  method fetch (line 325) | fetch() {}
  method fetch (line 340) | fetch() {}

FILE: packages/@pollyjs/adapter-fetch/types.d.ts
  class FetchAdapter (line 3) | class FetchAdapter extends Adapter<{

FILE: packages/@pollyjs/adapter-node-http/src/index.js
  constant IS_STUBBED (line 19) | const IS_STUBBED = Symbol();
  constant ABORT_HANDLER (line 20) | const ABORT_HANDLER = Symbol();
  constant REQUEST_ARGUMENTS (line 21) | const REQUEST_ARGUMENTS = new WeakMap();
  class HttpAdapter (line 27) | class HttpAdapter extends Adapter {
    method id (line 28) | static get id() {
    method onConnect (line 32) | onConnect() {
    method onDisconnect (line 49) | onDisconnect() {
    method setupNock (line 56) | setupNock() {
    method patchOverriddenMethods (line 93) | patchOverriddenMethods() {
    method unpatchOverriddenMethods (line 155) | unpatchOverriddenMethods() {
    method onRequest (line 167) | onRequest(pollyRequest) {
    method onFetchResponse (line 184) | async onFetchResponse(pollyRequest) {
    method onRespond (line 227) | async onRespond(pollyRequest, error) {
    method getBodyFromChunks (line 280) | getBodyFromChunks(chunks, headers) {
    method getChunksFromBody (line 315) | getChunksFromBody(body, headers, encoding) {

FILE: packages/@pollyjs/adapter-node-http/src/utils/get-url-from-options.js
  function getUrlFromOptions (line 10) | function getUrlFromOptions(options = {}) {

FILE: packages/@pollyjs/adapter-node-http/src/utils/merge-chunks.js
  function mergeChunks (line 9) | function mergeChunks(chunks) {

FILE: packages/@pollyjs/adapter-node-http/src/utils/url-to-options.js
  function urlToOptions (line 8) | function urlToOptions(url) {

FILE: packages/@pollyjs/adapter-node-http/tests/integration/adapter-test.js
  function commonTests (line 107) | function commonTests(transport) {

FILE: packages/@pollyjs/adapter-node-http/tests/jest/integration/xhr-test.js
  function request (line 5) | function request(url) {

FILE: packages/@pollyjs/adapter-node-http/tests/utils/get-buffer-from-stream.js
  function getBufferFromStream (line 1) | function getBufferFromStream(stream) {

FILE: packages/@pollyjs/adapter-node-http/tests/utils/get-response-from-request.js
  function getResponseFromRequest (line 1) | function getResponseFromRequest(req, data) {

FILE: packages/@pollyjs/adapter-node-http/tests/utils/native-request.js
  function nativeRequest (line 7) | async function nativeRequest(transport, url, options) {

FILE: packages/@pollyjs/adapter-node-http/types.d.ts
  class NodeHttpAdapter (line 3) | class NodeHttpAdapter extends Adapter {}

FILE: packages/@pollyjs/adapter-puppeteer/src/index.js
  constant LISTENERS (line 4) | const LISTENERS = Symbol();
  constant PASSTHROUGH_PROMISES (line 5) | const PASSTHROUGH_PROMISES = Symbol();
  constant PASSTHROUGH_REQ_ID_QP (line 6) | const PASSTHROUGH_REQ_ID_QP = 'pollyjs_passthrough_req_id';
  class PuppeteerAdapter (line 8) | class PuppeteerAdapter extends Adapter {
    method id (line 9) | static get id() {
    method defaultOptions (line 13) | get defaultOptions() {
    method constructor (line 20) | constructor() {
    method onConnect (line 29) | onConnect() {
    method onDisconnect (line 42) | onDisconnect() {
    method attachToPageEvents (line 48) | attachToPageEvents(page) {
    method onRequest (line 140) | onRequest(pollyRequest) {
    method onFetchResponse (line 157) | async onFetchResponse(pollyRequest) {
    method onRespond (line 196) | async onRespond(pollyRequest, error) {
    method _callListenersWith (line 214) | _callListenersWith(methodName, target) {

FILE: packages/@pollyjs/adapter-puppeteer/tests/helpers/fetch.js
  function fetch (line 3) | async function fetch() {

FILE: packages/@pollyjs/adapter-puppeteer/tests/integration/adapter-test.js
  constant HOST (line 11) | const HOST = 'http://localhost:4000';

FILE: packages/@pollyjs/adapter-puppeteer/types.d.ts
  class PuppeteerAdapter (line 3) | class PuppeteerAdapter extends Adapter<{

FILE: packages/@pollyjs/adapter-xhr/src/index.js
  constant SEND (line 10) | const SEND = Symbol();
  constant ABORT_HANDLER (line 11) | const ABORT_HANDLER = Symbol();
  constant BINARY_RESPONSE_TYPES (line 14) | const BINARY_RESPONSE_TYPES = ['arraybuffer', 'blob'];
  class XHRAdapter (line 16) | class XHRAdapter extends Adapter {
    method id (line 17) | static get id() {
    method defaultOptions (line 21) | get defaultOptions() {
    method onConnect (line 27) | onConnect() {
    method onDisconnect (line 57) | onDisconnect() {
    method onRequest (line 64) | onRequest(pollyRequest) {
    method onFetchResponse (line 75) | async onFetchResponse(pollyRequest) {
    method onRespond (line 140) | onRespond(pollyRequest, error) {

FILE: packages/@pollyjs/adapter-xhr/src/utils/resolve-xhr.js
  function resolveXhr (line 1) | function resolveXhr(xhr, body) {

FILE: packages/@pollyjs/adapter-xhr/src/utils/serialize-response-headers.js
  function serializeResponseHeaders (line 6) | function serializeResponseHeaders(responseHeaders) {

FILE: packages/@pollyjs/adapter-xhr/tests/integration/adapter-test.js
  class MockXMLHttpRequest (line 12) | class MockXMLHttpRequest {}

FILE: packages/@pollyjs/adapter-xhr/tests/utils/xhr-request.js
  function request (line 3) | function request(url, obj = {}) {

FILE: packages/@pollyjs/adapter-xhr/types.d.ts
  class XHRAdapter (line 3) | class XHRAdapter extends Adapter<{

FILE: packages/@pollyjs/adapter/src/index.js
  constant REQUEST_HANDLER (line 14) | const REQUEST_HANDLER = Symbol();
  class Adapter (line 16) | class Adapter {
    method constructor (line 17) | constructor(polly) {
    method type (line 22) | static get type() {
    method id (line 27) | static get id() {
    method defaultOptions (line 31) | get defaultOptions() {
    method options (line 35) | get options() {
    method persister (line 42) | get persister() {
    method connect (line 46) | connect() {
    method onConnect (line 57) | onConnect() {
    method disconnect (line 61) | disconnect() {
    method onDisconnect (line 72) | onDisconnect() {
    method timeout (line 76) | timeout(pollyRequest, { time }) {
    method handleRequest (line 84) | async handleRequest(request) {
    method [REQUEST_HANDLER] (line 106) | async [REQUEST_HANDLER](pollyRequest) {
    method passthrough (line 149) | async passthrough(pollyRequest) {
    method onPassthrough (line 158) | async onPassthrough(pollyRequest) {
    method intercept (line 164) | async intercept(pollyRequest, interceptor) {
    method onIntercept (line 177) | async onIntercept(pollyRequest, pollyResponse) {
    method record (line 181) | async record(pollyRequest) {
    method onRecord (line 197) | async onRecord(pollyRequest) {
    method replay (line 205) | async replay(pollyRequest) {
    method onReplay (line 272) | async onReplay(pollyRequest, normalizedResponse) {
    method assert (line 276) | assert(message, ...args) {
    method onRequest (line 286) | onRequest() {}
    method onIdentifyRequest (line 291) | async onIdentifyRequest(pollyRequest) {
    method onRequestFinished (line 303) | async onRequestFinished(pollyRequest) {
    method onRequestFailed (line 312) | async onRequestFailed(pollyRequest, error) {
    method onRespond (line 339) | async onRespond(/* pollyRequest, error */) {}
    method onFetchResponse (line 345) | async onFetchResponse(/* pollyRequest */) {

FILE: packages/@pollyjs/adapter/src/utils/dehumanize-time.js
  constant ALPHA_NUMERIC_DOT (line 1) | const ALPHA_NUMERIC_DOT = /([0-9.]+)([a-zA-Z]+)/g;
  constant TIMES (line 2) | const TIMES = {
  function dehumanizeTime (line 36) | function dehumanizeTime(input) {

FILE: packages/@pollyjs/adapter/src/utils/is-expired.js
  function isExpired (line 3) | function isExpired(recordedOn, expiresIn) {

FILE: packages/@pollyjs/adapter/src/utils/normalize-recorded-response.js
  function normalizeRecordedResponse (line 3) | function normalizeRecordedResponse(response) {
  function normalizeHeaders (line 15) | function normalizeHeaders(headers) {

FILE: packages/@pollyjs/adapter/src/utils/stringify-request.js
  function stringifyRequest (line 1) | function stringifyRequest(req, ...args) {

FILE: packages/@pollyjs/adapter/types.d.ts
  class Adapter (line 3) | class Adapter<

FILE: packages/@pollyjs/core/src/-private/container.js
  function keyFor (line 3) | function keyFor(Factory) {
  class Container (line 7) | class Container {
    method constructor (line 8) | constructor() {
    method register (line 17) | register(Factory) {
    method unregister (line 45) | unregister(keyOrFactory) {
    method lookup (line 59) | lookup(key) {
    method has (line 70) | has(keyOrFactory) {

FILE: packages/@pollyjs/core/src/-private/event-emitter.js
  constant EVENTS (line 9) | const EVENTS = Symbol();
  constant EVENT_NAMES (line 10) | const EVENT_NAMES = Symbol();
  function assertEventName (line 12) | function assertEventName(eventName, eventNames) {
  function assertListener (line 26) | function assertListener(listener) {
  class EventEmitter (line 33) | class EventEmitter {
    method constructor (line 39) | constructor(options = {}) {
    method eventNames (line 57) | eventNames() {
    method on (line 78) | on(eventName, listener, options = {}) {
    method once (line 129) | once(eventName, listener, options = {}) {
    method off (line 144) | off(eventName, listener) {
    method listeners (line 173) | listeners(eventName) {
    method hasListeners (line 186) | hasListeners(eventName) {
    method emit (line 207) | async emit(eventName, ...args) {
    method emitParallel (line 236) | async emitParallel(eventName, ...args) {
    method emitSync (line 265) | emitSync(eventName, ...args) {

FILE: packages/@pollyjs/core/src/-private/event.js
  constant STOP_PROPAGATION (line 3) | const STOP_PROPAGATION = Symbol();
  class Event (line 5) | class Event {
    method constructor (line 6) | constructor(type, props) {
    method stopPropagation (line 19) | stopPropagation() {
    method shouldStopPropagating (line 23) | get shouldStopPropagating() {

FILE: packages/@pollyjs/core/src/-private/http-base.js
  class HTTPBase (line 8) | class HTTPBase {
    method constructor (line 9) | constructor() {
    method getHeader (line 13) | getHeader(name) {
    method setHeader (line 17) | setHeader(name, value) {
    method setHeaders (line 23) | setHeaders(headers = {}) {
    method removeHeader (line 31) | removeHeader(name) {
    method removeHeaders (line 37) | removeHeaders(headers = []) {
    method hasHeader (line 45) | hasHeader(name) {
    method type (line 49) | type(type) {
    method send (line 53) | send(data) {
    method json (line 90) | json(obj) {
    method jsonBody (line 98) | jsonBody() {
    method end (line 102) | end() {

FILE: packages/@pollyjs/core/src/-private/interceptor.js
  constant ABORT (line 3) | const ABORT = Symbol();
  constant PASSTHROUGH (line 4) | const PASSTHROUGH = Symbol();
  function setDefaults (line 6) | function setDefaults(interceptor) {
  class Interceptor (line 11) | class Interceptor extends Event {
    method constructor (line 12) | constructor() {
    method abort (line 17) | abort() {
    method passthrough (line 22) | passthrough() {
    method shouldAbort (line 27) | get shouldAbort() {
    method shouldPassthrough (line 31) | get shouldPassthrough() {
    method shouldIntercept (line 35) | get shouldIntercept() {

FILE: packages/@pollyjs/core/src/-private/logger.js
  constant FORMATTED_ACTIONS (line 4) | const FORMATTED_ACTIONS = {
  class Logger (line 11) | class Logger {
    method constructor (line 12) | constructor(polly) {
    method connect (line 19) | connect() {
    method disconnect (line 27) | disconnect() {
    method logRequest (line 32) | logRequest(request) {
    method logRequestResponse (line 42) | logRequestResponse(request, response) {
    method logRequestError (line 54) | logRequestError(request, error) {

FILE: packages/@pollyjs/core/src/-private/request.js
  constant ROUTE (line 24) | const ROUTE = Symbol();
  constant POLLY (line 25) | const POLLY = Symbol();
  constant PARSED_URL (line 26) | const PARSED_URL = Symbol();
  constant EVENT_EMITTER (line 27) | const EVENT_EMITTER = Symbol();
  constant SUPPORTED_EVENTS (line 29) | const SUPPORTED_EVENTS = ['identify'];
  class PollyRequest (line 31) | class PollyRequest extends HTTPBase {
    method constructor (line 32) | constructor(polly, request) {
    method url (line 80) | get url() {
    method url (line 86) | set url(value) {
    method absoluteUrl (line 92) | get absoluteUrl() {
    method protocol (line 98) | get protocol() {
    method hostname (line 102) | get hostname() {
    method port (line 106) | get port() {
    method origin (line 110) | get origin() {
    method pathname (line 114) | get pathname() {
    method query (line 118) | get query() {
    method query (line 122) | set query(value) {
    method hash (line 126) | get hash() {
    method hash (line 130) | set hash(value) {
    method shouldPassthrough (line 134) | get shouldPassthrough() {
    method shouldIntercept (line 138) | get shouldIntercept() {
    method log (line 142) | get log() {
    method on (line 156) | on(eventName, listener) {
    method once (line 162) | once(eventName, listener) {
    method off (line 168) | off(eventName, listener) {
    method init (line 174) | async init() {
    method respond (line 189) | async respond(response) {
    method abort (line 233) | abort() {
    method overrideRecordingName (line 237) | overrideRecordingName(recordingName) {
    method configure (line 243) | configure(config) {
    method _intercept (line 248) | _intercept() {
    method _emit (line 252) | _emit(eventName, ...args) {
    method _identify (line 256) | async _identify() {

FILE: packages/@pollyjs/core/src/-private/response.js
  constant DEFAULT_STATUS_CODE (line 5) | const DEFAULT_STATUS_CODE = 200;
  class PollyResponse (line 7) | class PollyResponse extends HTTPBase {
    method constructor (line 8) | constructor(statusCode, headers, body, encoding) {
    method ok (line 16) | get ok() {
    method statusText (line 20) | get statusText() {
    method status (line 27) | status(statusCode) {
    method sendStatus (line 40) | sendStatus(status) {

FILE: packages/@pollyjs/core/src/polly.js
  constant RECORDING_NAME (line 15) | const RECORDING_NAME = Symbol();
  constant RECORDING_ID (line 16) | const RECORDING_ID = Symbol();
  constant PAUSED_ADAPTERS (line 17) | const PAUSED_ADAPTERS = Symbol();
  constant FACTORY_REGISTRATION (line 19) | const FACTORY_REGISTRATION = new WeakMap();
  constant EVENT_EMITTER (line 20) | const EVENT_EMITTER = new EventEmitter({
  class Polly (line 28) | class Polly {
    method constructor (line 29) | constructor(recordingName, config) {
    method VERSION (line 57) | static get VERSION() {
    method recordingName (line 65) | get recordingName() {
    method recordingName (line 69) | set recordingName(name) {
    method recordingId (line 81) | get recordingId() {
    method mode (line 85) | get mode() {
    method mode (line 89) | set mode(mode) {
    method on (line 102) | static on(eventName, listener) {
    method once (line 108) | static once(eventName, listener) {
    method off (line 114) | static off(eventName, listener) {
    method register (line 120) | static register(Factory) {
    method unregister (line 132) | static unregister(Factory) {
    method configure (line 145) | configure(config = {}) {
    method record (line 200) | record() {
    method replay (line 208) | replay() {
    method passthrough (line 216) | passthrough() {
    method pause (line 224) | pause() {
    method play (line 233) | play() {
    method stop (line 244) | async stop() {
    method flush (line 264) | async flush() {
    method connectTo (line 279) | connectTo(idOrAdapter) {
    method disconnectFrom (line 306) | disconnectFrom(idOrAdapter) {
    method disconnect (line 324) | disconnect() {
    method registerRequest (line 336) | registerRequest(request = {}) {

FILE: packages/@pollyjs/core/src/server/handler.js
  class Handler (line 11) | class Handler extends Map {
    method constructor (line 12) | constructor() {
    method on (line 32) | on(eventName, listener, options = {}) {
    method once (line 41) | once(eventName, listener) {
    method off (line 47) | off(eventName, listener) {
    method passthrough (line 53) | passthrough(value = true) {
    method intercept (line 63) | intercept(fn, options = {}) {
    method recordingName (line 84) | recordingName(recordingName) {
    method configure (line 94) | configure(config) {
    method filter (line 101) | filter(fn) {
    method times (line 112) | times(n) {

FILE: packages/@pollyjs/core/src/server/index.js
  constant HOST (line 9) | const HOST = Symbol();
  constant NAMESPACES (line 10) | const NAMESPACES = Symbol();
  constant REGISTRY (line 11) | const REGISTRY = Symbol();
  constant MIDDLEWARE (line 12) | const MIDDLEWARE = Symbol();
  constant HANDLERS (line 13) | const HANDLERS = Symbol();
  constant CHARS (line 15) | const CHARS = {
  function parseUrl (line 23) | function parseUrl(url) {
  class Server (line 35) | class Server {
    method constructor (line 36) | constructor() {
    method host (line 43) | host(path, callback) {
    method namespace (line 53) | namespace(path, callback) {
    method timeout (line 61) | timeout() {
    method get (line 65) | get() {
    method put (line 69) | put() {
    method post (line 73) | post() {
    method delete (line 77) | delete() {
    method patch (line 81) | patch() {
    method merge (line 85) | merge() {
    method head (line 89) | head() {
    method options (line 93) | options() {
    method any (line 97) | any() {
    method lookup (line 101) | lookup(method, url) {
    method _lookupMiddleware (line 105) | _lookupMiddleware(url) {
    method _register (line 111) | _register(method, routes) {
    method _registerMiddleware (line 131) | _registerMiddleware(routes) {
    method _recognize (line 163) | _recognize(method, url) {
    method _buildUrl (line 170) | _buildUrl(path) {
    method _nameForPath (line 180) | _nameForPath(path = '') {
    method _registryForHost (line 203) | _registryForHost(host) {

FILE: packages/@pollyjs/core/src/server/middleware.js
  constant GLOBAL (line 5) | const GLOBAL = '__GLOBAL__';
  class Middleware (line 7) | class Middleware {
    method constructor (line 8) | constructor({ host, paths, global, handler }) {
    method match (line 20) | match(host, path) {

FILE: packages/@pollyjs/core/src/server/route.js
  constant HANDLERS (line 3) | const HANDLERS = Symbol();
  function requestWithParams (line 5) | function requestWithParams(req, { params }) {
  class Route (line 25) | class Route {
    method constructor (line 31) | constructor(recognizeResults, middleware) {
    method shouldPassthrough (line 48) | shouldPassthrough() {
    method shouldIntercept (line 52) | shouldIntercept() {
    method recordingName (line 56) | recordingName() {
    method config (line 60) | config() {
    method applyFiltersWithArgs (line 66) | applyFiltersWithArgs(req, ...args) {
    method intercept (line 80) | async intercept(req, res, interceptor) {
    method emit (line 102) | async emit(eventName, req, ...args) {
    method _orderedHandlers (line 116) | _orderedHandlers() {
    method _valueFor (line 124) | _valueFor(key) {

FILE: packages/@pollyjs/core/src/test-helpers/lib.js
  function beforeEach (line 7) | function beforeEach(context, recordingName, defaults) {
  function afterEach (line 16) | async function afterEach(context, framework) {

FILE: packages/@pollyjs/core/src/test-helpers/mocha.js
  function generateRecordingName (line 3) | function generateRecordingName(context) {
  function setupMocha (line 16) | function setupMocha(defaults = {}, ctx = global) {

FILE: packages/@pollyjs/core/src/test-helpers/qunit.js
  function generateRecordingName (line 3) | function generateRecordingName(assert) {
  function setupQunit (line 7) | function setupQunit(hooks, defaults = {}) {

FILE: packages/@pollyjs/core/src/utils/cancel-fn-after-n-times.js
  function cancelFnAfterNTimes (line 11) | function cancelFnAfterNTimes(fn, nTimes, cancel) {

FILE: packages/@pollyjs/core/src/utils/deferred-promise.js
  function defer (line 4) | function defer() {

FILE: packages/@pollyjs/core/src/utils/guid-for-recording.js
  function sanitize (line 4) | function sanitize(str) {
  function guidFor (line 9) | function guidFor(str) {
  function guidForRecording (line 19) | function guidForRecording(recording) {

FILE: packages/@pollyjs/core/src/utils/http-headers.js
  constant HANDLER (line 5) | const HANDLER = {
  method get (line 6) | get(obj, prop) {
  method set (line 11) | set(obj, prop, value) {
  method deleteProperty (line 25) | deleteProperty(obj, prop) {
  function HTTPHeaders (line 36) | function HTTPHeaders(headers) {

FILE: packages/@pollyjs/core/src/utils/merge-configs.js
  function customizer (line 3) | function customizer(objValue, srcValue, key) {
  function mergeConfigs (line 11) | function mergeConfigs(...configs) {

FILE: packages/@pollyjs/core/src/utils/normalize-request.js
  function isFunction (line 11) | function isFunction(fn) {
  function method (line 15) | function method(method, config, req) {
  function url (line 19) | function url(url, config, req) {
  function headers (line 43) | function headers(headers, config, req) {
  function body (line 57) | function body(body, config, req) {

FILE: packages/@pollyjs/core/src/utils/parse-url.js
  function parseUrl (line 13) | function parseUrl(url, ...args) {

FILE: packages/@pollyjs/core/src/utils/remove-host-from-url.js
  function removeHostFromUrl (line 6) | function removeHostFromUrl(url) {

FILE: packages/@pollyjs/core/src/utils/timing.js
  method fixed (line 4) | fixed(ms) {
  method relative (line 8) | relative(ratio) {

FILE: packages/@pollyjs/core/src/utils/validators.js
  function validateRecordingName (line 4) | function validateRecordingName(name) {
  function validateRequestConfig (line 16) | function validateRequestConfig(config) {
  function validateTimesOption (line 37) | function validateTimesOption(times) {

FILE: packages/@pollyjs/core/tests/unit/-private/container-test.js
  class Factory (line 7) | class Factory {
    method id (line 8) | static get id() {
    method type (line 12) | static get type() {
  class NoId (line 34) | class NoId extends Factory {
    method id (line 35) | static get id() {
  class NoType (line 40) | class NoType extends Factory {
    method type (line 41) | static get type() {
  class ExtendedFactory (line 89) | class ExtendedFactory extends Factory {
    method id (line 90) | static get id() {

FILE: packages/@pollyjs/core/tests/unit/-private/event-emitter-test.js
  function assertEventName (line 7) | function assertEventName(methodName) {
  function assertListener (line 18) | function assertListener(methodName) {

FILE: packages/@pollyjs/core/tests/unit/-private/event-test.js
  constant EVENT_TYPE (line 5) | const EVENT_TYPE = 'foo';

FILE: packages/@pollyjs/core/tests/unit/polly-test.js
  class MockAdapter (line 86) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {
  class MockPersister (line 111) | class MockPersister extends Persister {
    method id (line 112) | static get id() {
    method constructor (line 116) | constructor() {
    method persist (line 121) | persist() {
  class MockAdapterA (line 194) | class MockAdapterA extends Adapter {
    method id (line 195) | static get id() {
    method onConnect (line 199) | onConnect() {}
    method onDisconnect (line 200) | onDisconnect() {}
    method id (line 269) | static get id() {
    method onConnect (line 273) | onConnect() {}
    method onDisconnect (line 274) | onDisconnect() {}
    method id (line 414) | static get id() {
    method onConnect (line 418) | onConnect() {}
    method onDisconnect (line 420) | onDisconnect() {
  class MockAdapterB (line 203) | class MockAdapterB extends MockAdapterA {
    method id (line 204) | static get id() {
    method id (line 278) | static get id() {
    method id (line 426) | static get id() {
  class MockAdapter (line 222) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {
  class MockAdapter (line 242) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {
  class MockAdapterA (line 268) | class MockAdapterA extends Adapter {
    method id (line 195) | static get id() {
    method onConnect (line 199) | onConnect() {}
    method onDisconnect (line 200) | onDisconnect() {}
    method id (line 269) | static get id() {
    method onConnect (line 273) | onConnect() {}
    method onDisconnect (line 274) | onDisconnect() {}
    method id (line 414) | static get id() {
    method onConnect (line 418) | onConnect() {}
    method onDisconnect (line 420) | onDisconnect() {
  class MockAdapterB (line 277) | class MockAdapterB extends MockAdapterA {
    method id (line 204) | static get id() {
    method id (line 278) | static get id() {
    method id (line 426) | static get id() {
  class MockAdapter (line 354) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {
  class MockAdapter (line 383) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {
  class MockAdapterA (line 413) | class MockAdapterA extends Adapter {
    method id (line 195) | static get id() {
    method onConnect (line 199) | onConnect() {}
    method onDisconnect (line 200) | onDisconnect() {}
    method id (line 269) | static get id() {
    method onConnect (line 273) | onConnect() {}
    method onDisconnect (line 274) | onDisconnect() {}
    method id (line 414) | static get id() {
    method onConnect (line 418) | onConnect() {}
    method onDisconnect (line 420) | onDisconnect() {
  class MockAdapterB (line 425) | class MockAdapterB extends MockAdapterA {
    method id (line 204) | static get id() {
    method id (line 278) | static get id() {
    method id (line 426) | static get id() {
  class MockAdapter (line 455) | class MockAdapter extends Adapter {
    method id (line 87) | static get id() {
    method onConnect (line 91) | onConnect() {
    method onDisconnect (line 95) | onDisconnect() {
    method id (line 223) | static get id() {
    method onConnect (line 227) | onConnect() {
    method onDisconnect (line 230) | onDisconnect() {}
    method id (line 243) | static get id() {
    method onConnect (line 247) | onConnect() {
    method onDisconnect (line 250) | onDisconnect() {
    method id (line 355) | static get id() {
    method onConnect (line 359) | onConnect() {
    method onDisconnect (line 363) | onDisconnect() {
    method id (line 384) | static get id() {
    method onConnect (line 388) | onConnect() {
    method onDisconnect (line 392) | onDisconnect() {
    method id (line 456) | static get id() {

FILE: packages/@pollyjs/core/tests/unit/server/server-test.js
  function request (line 7) | function request(method, path) {
  function addHandlers (line 118) | function addHandlers(url) {

FILE: packages/@pollyjs/core/tests/unit/test-helpers/mocha-test.js
  class Sandbox (line 3) | class Sandbox {
    method constructor (line 4) | constructor(context) {
    method beforeEach (line 10) | beforeEach(fn) {
    method afterEach (line 15) | afterEach(fn) {

FILE: packages/@pollyjs/core/tests/unit/utils/timing-test.js
  function fixedTest (line 3) | function fixedTest(ms) {
  function relativeTest (line 22) | function relativeTest(ratio) {

FILE: packages/@pollyjs/core/types.d.ts
  type Newable (line 5) | type Newable<T> = { new (...args: any[]): T };
  type MODE (line 7) | type MODE = 'record' | 'replay' | 'passthrough' | 'stopped';
  type ACTION (line 8) | type ACTION = 'record' | 'replay' | 'intercept' | 'passthrough';
  type EXPIRY_STRATEGY (line 9) | type EXPIRY_STRATEGY = 'record' | 'warn' | 'error';
  type MatchBy (line 16) | type MatchBy<T = string, R = T> = (input: T, req: Request) => R;
  type Headers (line 17) | type Headers = Record<string, string | string[]>;
  type PollyConfig (line 18) | interface PollyConfig {
  type HTTPBase (line 87) | interface HTTPBase {
  type RequestEvent (line 103) | type RequestEvent = 'identify';
  type RequestArguments (line 104) | type RequestArguments = { [key: string]: any };
  type Request (line 106) | interface Request<TArguments extends RequestArguments = {}>
  type Response (line 137) | interface Response extends HTTPBase {
  type RequestRouteEvent (line 148) | type RequestRouteEvent = 'request';
  type RecordingRouteEvent (line 149) | type RecordingRouteEvent = 'beforeReplay' | 'beforePersist';
  type ResponseRouteEvent (line 150) | type ResponseRouteEvent = 'beforeResponse' | 'response';
  type ErrorRouteEvent (line 151) | type ErrorRouteEvent = 'error';
  type AbortRouteEvent (line 152) | type AbortRouteEvent = 'abort';
  type ListenerEvent (line 154) | interface ListenerEvent {
  type Interceptor (line 158) | interface Interceptor extends ListenerEvent {
  type ErrorEventListener (line 162) | type ErrorEventListener = (
  type AbortEventListener (line 167) | type AbortEventListener = (
  type RequestEventListener (line 171) | type RequestEventListener = (
  type RecordingEventListener (line 175) | type RecordingEventListener = (
  type ResponseEventListener (line 180) | type ResponseEventListener = (
  type InterceptHandler (line 185) | type InterceptHandler = (
  class RouteHandler (line 190) | class RouteHandler {
  class PollyServer (line 228) | class PollyServer {
  class PollyLogger (line 242) | class PollyLogger {
  type PollyEvent (line 251) | type PollyEvent = 'create' | 'stop' | 'register';
  type PollyEventListener (line 252) | type PollyEventListener = (poll: Polly) => void;
  class Polly (line 253) | class Polly {

FILE: packages/@pollyjs/ember/blueprints/@pollyjs/ember/index.js
  method normalizeEntityName (line 5) | normalizeEntityName() {}
  method afterInstall (line 6) | afterInstall() {

FILE: packages/@pollyjs/ember/index.js
  function determineEnv (line 12) | function determineEnv() {
  method init (line 43) | init() {
  method treeForAddon (line 52) | treeForAddon() {
  method contentFor (line 60) | contentFor(name) {
  method _pollyConfig (line 73) | _pollyConfig(env) {
  method serverMiddleware (line 101) | serverMiddleware(startOptions) {
  method testemMiddleware (line 105) | testemMiddleware(app) {

FILE: packages/@pollyjs/ember/tests/dummy/app/app.js
  class App (line 6) | class App extends Application {

FILE: packages/@pollyjs/ember/tests/dummy/app/router.js
  class Router (line 4) | class Router extends EmberRouter {

FILE: packages/@pollyjs/node-server/src/api.js
  class API (line 6) | class API {
    method constructor (line 7) | constructor(options = {}) {
    method getRecording (line 18) | getRecording(recording) {
    method saveRecording (line 28) | saveRecording(recording, data) {
    method deleteRecording (line 36) | deleteRecording(recording) {
    method filenameFor (line 46) | filenameFor(recording) {
    method respond (line 50) | respond(status, body) {

FILE: packages/@pollyjs/node-server/src/express/register-api.js
  function prependSlash (line 8) | function prependSlash(slash = '') {
  function registerAPI (line 16) | function registerAPI(app, config) {

FILE: packages/@pollyjs/node-server/src/server.js
  class Server (line 11) | class Server {
    method constructor (line 12) | constructor(config = {}) {
    method listen (line 31) | listen(port, host) {

FILE: packages/@pollyjs/node-server/types.d.ts
  type Config (line 5) | interface Config {
  type ServerConfig (line 13) | interface ServerConfig extends Config {
  type APIResponse (line 19) | interface APIResponse {
  class API (line 24) | class API {
  class Server (line 33) | class Server {

FILE: packages/@pollyjs/persister-fs/src/index.js
  class FSPersister (line 6) | class FSPersister extends Persister {
    method constructor (line 7) | constructor() {
    method id (line 12) | static get id() {
    method defaultOptions (line 16) | get defaultOptions() {
    method onFindRecording (line 22) | onFindRecording(recordingId) {
    method onSaveRecording (line 26) | onSaveRecording(recordingId, data) {
    method onDeleteRecording (line 34) | onDeleteRecording(recordingId) {

FILE: packages/@pollyjs/persister-fs/tests/unit/persister-test.js
  class MockPolly (line 6) | class MockPolly {
    method constructor (line 7) | constructor(persisterOptions = {}) {

FILE: packages/@pollyjs/persister-fs/types.d.ts
  class FSPersister (line 3) | class FSPersister extends Persister<{

FILE: packages/@pollyjs/persister-in-memory/src/index.js
  class InMemoryPersister (line 5) | class InMemoryPersister extends Persister {
    method id (line 6) | static get id() {
    method onFindRecording (line 10) | onFindRecording(recordingId) {
    method onSaveRecording (line 14) | onSaveRecording(recordingId, data) {
    method onDeleteRecording (line 18) | onDeleteRecording(recordingId) {

FILE: packages/@pollyjs/persister-in-memory/types.d.ts
  class InMemoryPersister (line 3) | class InMemoryPersister extends Persister {}

FILE: packages/@pollyjs/persister-local-storage/src/index.js
  class LocalStoragePersister (line 5) | class LocalStoragePersister extends Persister {
    method id (line 6) | static get id() {
    method defaultOptions (line 10) | get defaultOptions() {
    method localStorage (line 17) | get localStorage() {
    method db (line 28) | get db() {
    method db (line 34) | set db(db) {
    method onFindRecording (line 38) | onFindRecording(recordingId) {
    method onSaveRecording (line 42) | onSaveRecording(recordingId, data) {
    method onDeleteRecording (line 49) | onDeleteRecording(recordingId) {

FILE: packages/@pollyjs/persister-local-storage/types.d.ts
  class LocalStoragePersister (line 3) | class LocalStoragePersister extends Persister<{

FILE: packages/@pollyjs/persister-rest/src/ajax.js
  constant REQUEST_ASYNC (line 2) | const REQUEST_ASYNC =
  function ajax (line 6) | function ajax(url, options = {}) {
  function handleResponse (line 32) | function handleResponse(xhr, resolve, reject) {

FILE: packages/@pollyjs/persister-rest/src/index.js
  class RestPersister (line 6) | class RestPersister extends Persister {
    method id (line 7) | static get id() {
    method defaultOptions (line 11) | get defaultOptions() {
    method ajax (line 18) | ajax(url, ...args) {
    method onFindRecording (line 24) | async onFindRecording(recordingId) {
    method onSaveRecording (line 32) | async onSaveRecording(recordingId, data) {
    method onDeleteRecording (line 43) | async onDeleteRecording(recordingId) {
    method _normalize (line 49) | _normalize({ xhr, body }) {

FILE: packages/@pollyjs/persister-rest/types.d.ts
  class RESTPersister (line 3) | class RESTPersister extends Persister<{

FILE: packages/@pollyjs/persister/src/har/entry.js
  function totalTime (line 6) | function totalTime(timings = {}) {
  class Entry (line 13) | class Entry {
    method constructor (line 14) | constructor(request) {

FILE: packages/@pollyjs/persister/src/har/index.js
  class HAR (line 3) | class HAR {
    method constructor (line 4) | constructor(opts = {}) {

FILE: packages/@pollyjs/persister/src/har/log.js
  class Log (line 13) | class Log {
    method constructor (line 14) | constructor(opts = {}) {
    method addEntries (line 31) | addEntries(entries = []) {
    method sortEntries (line 39) | sortEntries() {

FILE: packages/@pollyjs/persister/src/har/request.js
  function headersSize (line 7) | function headersSize(request) {
  class Request (line 26) | class Request {
    method constructor (line 27) | constructor(request) {

FILE: packages/@pollyjs/persister/src/har/response.js
  function headersSize (line 7) | function headersSize(response) {
  class Response (line 24) | class Response {
    method constructor (line 25) | constructor(response) {

FILE: packages/@pollyjs/persister/src/har/utils/get-first-header.js
  function getFirstHeader (line 12) | function getFirstHeader(r, name) {

FILE: packages/@pollyjs/persister/src/har/utils/to-nv-pairs.js
  function toNVPairs (line 4) | function toNVPairs(o) {

FILE: packages/@pollyjs/persister/src/index.js
  constant CREATOR_NAME (line 7) | const CREATOR_NAME = 'Polly.JS';
  class Persister (line 9) | class Persister {
    method constructor (line 10) | constructor(polly) {
    method type (line 16) | static get type() {
    method id (line 21) | static get id() {
    method defaultOptions (line 25) | get defaultOptions() {
    method options (line 29) | get options() {
    method hasPending (line 36) | get hasPending() {
    method persist (line 45) | async persist() {
    method recordRequest (line 103) | recordRequest(pollyRequest) {
    method findRecording (line 122) | async findRecording(recordingId) {
    method onFindRecording (line 149) | onFindRecording() {
    method saveRecording (line 153) | async saveRecording(recordingId, har) {
    method onSaveRecording (line 159) | onSaveRecording() {
    method deleteRecording (line 163) | async deleteRecording(recordingId) {
    method onDeleteRecording (line 168) | onDeleteRecording() {
    method findEntry (line 172) | async findEntry(pollyRequest) {
    method stringify (line 185) | stringify() {
    method assert (line 189) | assert(message, ...args) {
    method _removeUnusedEntries (line 203) | _removeUnusedEntries(recordingId, har) {

FILE: packages/@pollyjs/persister/tests/unit/persister-test.js
  class CustomPersister (line 23) | class CustomPersister extends Persister {
    method id (line 24) | static get id() {
    method onFindRecording (line 28) | async onFindRecording() {
    method onSaveRecording (line 35) | async onSaveRecording() {
    method onDeleteRecording (line 40) | async onDeleteRecording() {

FILE: packages/@pollyjs/persister/types.d.ts
  type NVObject (line 4) | type NVObject = { name: string; value: string };
  type HarRequest (line 6) | interface HarRequest {
  type HarResponse (line 22) | interface HarResponse {
  type HarEntry (line 38) | interface HarEntry {
  type HarLog (line 57) | interface HarLog {
  type Har (line 66) | interface Har {
  class Persister (line 70) | class Persister<TOptions extends {} = {}> {

FILE: packages/@pollyjs/utils/src/utils/build-url.js
  function buildUrl (line 3) | function buildUrl(...paths) {

FILE: packages/@pollyjs/utils/src/utils/clone-arraybuffer.js
  function cloneArrayBuffer (line 6) | function cloneArrayBuffer(arrayBuffer) {

FILE: packages/@pollyjs/utils/src/utils/is-buffer-utf8-representable.js
  function isBufferUtf8Representable (line 7) | function isBufferUtf8Representable(buffer) {

FILE: packages/@pollyjs/utils/src/utils/polly-error.js
  class PollyError (line 1) | class PollyError extends Error {
    method constructor (line 2) | constructor(message, ...args) {

FILE: packages/@pollyjs/utils/src/utils/serializers/blob.js
  function readBlob (line 9) | function readBlob(blob) {
  function serialize (line 20) | async function serialize(body) {

FILE: packages/@pollyjs/utils/src/utils/serializers/buffer.js
  function serialize (line 6) | function serialize(body) {

FILE: packages/@pollyjs/utils/src/utils/serializers/form-data.js
  function serialize (line 5) | async function serialize(body) {

FILE: packages/@pollyjs/utils/src/utils/timeout.js
  function timeout (line 1) | function timeout(time) {

FILE: packages/@pollyjs/utils/src/utils/timestamp.js
  function timestamp (line 1) | function timestamp() {

FILE: packages/@pollyjs/utils/src/utils/url.js
  constant ARRAY_FORMAT (line 4) | const ARRAY_FORMAT = Symbol();
  constant INDICES_REGEX (line 5) | const INDICES_REGEX = /\[\d+\]$/;
  constant BRACKETS_REGEX (line 6) | const BRACKETS_REGEX = /\[\]$/;
  function parseQuery (line 8) | function parseQuery(query, options) {
  function stringifyQuery (line 17) | function stringifyQuery(obj, options = {}) {
  function arrayFormat (line 32) | function arrayFormat(query) {
  class URL (line 61) | class URL extends URLParse {
    method constructor (line 62) | constructor(url, parse) {
    method set (line 80) | set(part, value, fn) {
    method toString (line 100) | toString() {

FILE: packages/@pollyjs/utils/tests/serializer-tests.js
  function serializerTests (line 1) | function serializerTests(serialize) {

FILE: packages/@pollyjs/utils/types.d.ts
  type MODES (line 1) | enum MODES {
  type ACTIONS (line 8) | enum ACTIONS {
  type EXPIRY_STRATEGIES (line 15) | enum EXPIRY_STRATEGIES {

FILE: scripts/rollup/browser.config.js
  function createBrowserConfig (line 14) | function createBrowserConfig(options = {}, targets) {

FILE: scripts/rollup/browser.test.config.js
  function createBrowserTestConfig (line 8) | function createBrowserTestConfig(options = {}) {

FILE: scripts/rollup/jest.test.config.js
  function createJestTestConfig (line 6) | function createJestTestConfig(options = {}) {

FILE: scripts/rollup/node.config.js
  function createNodeConfig (line 12) | function createNodeConfig(options = {}) {

FILE: scripts/rollup/node.test.config.js
  function createNodeTestConfig (line 12) | function createNodeTestConfig(options = {}) {

FILE: tests/helpers/file.js
  method value (line 42) | value() {

FILE: tests/helpers/setup-fetch-record.js
  method fetch (line 3) | fetch() {
  function setupFetchRecord (line 8) | function setupFetchRecord(options) {

FILE: tests/helpers/setup-persister.js
  function setupPersister (line 1) | function setupPersister() {

FILE: tests/integration/adapter-browser-tests.js
  function adapterBrowserTests (line 4) | function adapterBrowserTests() {

FILE: tests/integration/adapter-identifier-tests.js
  function adapterIdentifierTests (line 4) | function adapterIdentifierTests() {
  function captureRequests (line 249) | function captureRequests(server) {
  function lookupAdapterName (line 257) | function lookupAdapterName(polly) {
  function testConfiguration (line 261) | function testConfiguration(optionName, value, expectedValues) {

FILE: tests/integration/adapter-node-tests.js
  function adapterNodeTests (line 3) | function adapterNodeTests() {

FILE: tests/integration/adapter-polly-tests.js
  function pollyTests (line 1) | function pollyTests() {

FILE: tests/integration/adapter-tests.js
  function adapterTests (line 4) | function adapterTests() {

FILE: tests/integration/persister-tests.js
  function persisterTests (line 4) | function persisterTests() {
Condensed preview — 393 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,257K chars).
[
  {
    "path": ".commitlintrc.js",
    "chars": 208,
    "preview": "/* eslint-env node */\n\nmodule.exports = {\n  extends: [\n    '@commitlint/config-lerna-scopes',\n    '@commitlint/config-co"
  },
  {
    "path": ".eslintignore",
    "chars": 99,
    "preview": "/packages/@pollyjs/ember/tests/**/index.html\nCHANGELOG.md\npackage.json\nnode_modules\ntmp\nbuild\ndist\n"
  },
  {
    "path": ".eslintrc.js",
    "chars": 1701,
    "preview": "/* eslint-env node */\n\nmodule.exports = {\n  root: true,\n  parserOptions: {\n    ecmaVersion: 2018,\n    sourceType: 'modul"
  },
  {
    "path": ".github/issue_template.md",
    "chars": 1804,
    "preview": "## Prerequisites\n\n- We realize there is a lot of data requested here. We ask only that you do your best to provide as mu"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 1260,
    "preview": "<!--- Provide a general summary of your changes in the Title above -->\n\n## Description\n\n<!--- Describe your changes in d"
  },
  {
    "path": ".gitignore",
    "chars": 361,
    "preview": ".DS_Store\nnode_modules\npackage-lock.json\nlerna-debug.log\npackages/**/dist/\nyarn-error.log\ntmp\nbuild\ndist\n*.lerna_backup\n"
  },
  {
    "path": ".husky/commit-msg",
    "chars": 70,
    "preview": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nyarn commitlint --edit \"$1\"\n"
  },
  {
    "path": ".husky/pre-commit",
    "chars": 59,
    "preview": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nyarn lint-staged\n"
  },
  {
    "path": ".mocharc.js",
    "chars": 117,
    "preview": "module.exports = {\n  spec: './packages/@pollyjs/*/build/node/*.js',\n  ui: 'bdd',\n  require: 'tests/node-setup.js'\n};\n"
  },
  {
    "path": ".prettierrc.js",
    "chars": 82,
    "preview": "'use strict';\n\nmodule.exports = {\n  singleQuote: true,\n  trailingComma: 'none'\n};\n"
  },
  {
    "path": ".travis.yml",
    "chars": 366,
    "preview": "language: node_js\nnode_js:\n  - '12'\n  - '14'\n  - '16'\n\naddons:\n  chrome: stable\n\ncache:\n  yarn: true\n\nbefore_install:\n  "
  },
  {
    "path": "CHANGELOG.md",
    "chars": 30109,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2929,
    "preview": "# Contributing\n\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n\n## G"
  },
  {
    "path": "LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "OSSMETADATA",
    "chars": 20,
    "preview": "osslifecycle=active\n"
  },
  {
    "path": "README.md",
    "chars": 10821,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "docs/.nojekyll",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs/_coverpage.md",
    "chars": 566,
    "preview": "<div class=\"netflix-logo\">\n  <div class=\"logo\"></div>\n</div>\n\n![logo](assets/images/wordmark-logo-alt.png)\n\n> Record, re"
  },
  {
    "path": "docs/_sidebar.md",
    "chars": 1278,
    "preview": "- Getting Started\n\n  - [Overview](README.md)\n  - [Quick Start](quick-start.md)\n  - [Examples](examples.md)\n\n- Test Frame"
  },
  {
    "path": "docs/adapters/custom.md",
    "chars": 3994,
    "preview": "# Custom Adapter\n\nIf you need to create your own adapter or modify an pre-existing one, you've come\nto the right page!\n\n"
  },
  {
    "path": "docs/adapters/fetch.md",
    "chars": 1344,
    "preview": "# Fetch Adapter\n\nThe fetch adapter wraps the global fetch method for seamless\nrecording and replaying of requests.\n\n## I"
  },
  {
    "path": "docs/adapters/node-http.md",
    "chars": 1238,
    "preview": "# Node HTTP Adapter\n\nThe node-http adapter provides a low level nodejs http request adapter that uses [nock](https://git"
  },
  {
    "path": "docs/adapters/playwright.md",
    "chars": 340,
    "preview": "# Playwright Adapter\n\nThe 3rd party [Playwright](https://playwright.dev/) adapter is provided by [@gribnoysup](https://g"
  },
  {
    "path": "docs/adapters/puppeteer.md",
    "chars": 2367,
    "preview": "# Puppeteer Adapter\n\nThe [Puppeteer](https://pptr.dev/) adapter attaches events to a given\n[page](https://pptr.dev/#?pro"
  },
  {
    "path": "docs/adapters/xhr.md",
    "chars": 1443,
    "preview": "# XHR Adapter\n\nThe XHR adapter uses Sinon's [Nise](https://github.com/sinonjs/nise) library\nto fake the global `XMLHttpR"
  },
  {
    "path": "docs/api.md",
    "chars": 6080,
    "preview": "# API\n\n## Constructor\n\nCreate a new Polly instance.\n\n| Param         | Type     | Description                           "
  },
  {
    "path": "docs/assets/styles.css",
    "chars": 6221,
    "preview": ":root {\n  --theme-color: #e50914;\n  --theme-color-dark: #b20710;\n\n  --text-color-base: #2e2e46;\n  --text-color-secondary"
  },
  {
    "path": "docs/cli/commands.md",
    "chars": 766,
    "preview": "# Commands\n\nAs of right now, the Polly CLI only knows one command but expect to see more\nin the near future!\n\n## listen\n"
  },
  {
    "path": "docs/cli/overview.md",
    "chars": 570,
    "preview": "# Overview\n\nThe `@pollyjs/cli` package provides a standalone CLI to quickly get you setup\nand ready to go.\n\n## Installat"
  },
  {
    "path": "docs/configuration.md",
    "chars": 11886,
    "preview": "# Configuration\n\nA Polly instance can be configured by passing a configuration object\nto the constructor's 2nd argument:"
  },
  {
    "path": "docs/examples.md",
    "chars": 2273,
    "preview": "# Examples\n\n## Client Server\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/client-server)**\n\n"
  },
  {
    "path": "docs/frameworks/ember-cli.md",
    "chars": 1235,
    "preview": "# Ember CLI\n\nInstalling the `@pollyjs/ember` addon will import and vendor the necessary\nPolly.JS packages as well as reg"
  },
  {
    "path": "docs/index.html",
    "chars": 2802,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>Polly.JS</title>\n    <meta http-equiv="
  },
  {
    "path": "docs/node-server/express-integrations.md",
    "chars": 694,
    "preview": "# Express Integrations\n\nThe `@pollyjs/node-server` package exports a `registerExpressAPI` method which\ntakes in an [Expr"
  },
  {
    "path": "docs/node-server/overview.md",
    "chars": 2920,
    "preview": "# Overview\n\nThe `@pollyjs/node-server` package provides a standalone node server as well as\nan express integration to be"
  },
  {
    "path": "docs/persisters/custom.md",
    "chars": 2097,
    "preview": "# Custom Persister\n\nIf you need to create your own persister or modify an pre-existing one, you've come\nto the right pag"
  },
  {
    "path": "docs/persisters/fs.md",
    "chars": 868,
    "preview": "# File System Persister\n\nRead and write recordings to and from the file system.\n\n## Installation\n\n_Note that you must ha"
  },
  {
    "path": "docs/persisters/local-storage.md",
    "chars": 1231,
    "preview": "# Local Storage Persister\n\nRead and write recordings to and from the browser's Local Storage.\n\n## Installation\n\n_Note th"
  },
  {
    "path": "docs/persisters/rest.md",
    "chars": 1507,
    "preview": "# REST Persister\n\nRead and write recordings to and from the file system via a CRUD API hosted\non a server.\n\n## Installat"
  },
  {
    "path": "docs/quick-start.md",
    "chars": 10470,
    "preview": "# Quick Start\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/core -"
  },
  {
    "path": "docs/server/api.md",
    "chars": 1900,
    "preview": "# API\n\n## HTTP Methods\n\nThe `GET`, `PUT`, `POST`, `PATCH`, `DELETE`, `MERGE`, `HEAD`, and `OPTIONS` HTTP methods\nhave a "
  },
  {
    "path": "docs/server/event.md",
    "chars": 680,
    "preview": "# Event\n\n## Properties\n\n### type\n\n_Type_: `String`\n\nThe event type. (e.g. `request`, `response`, `beforePersist`)\n\n## Me"
  },
  {
    "path": "docs/server/events-and-middleware.md",
    "chars": 5382,
    "preview": "# Events & Middleware\n\n## Events\n\nEvents can be attached to a server route using `.on()` and detached via\nthe `.off()` m"
  },
  {
    "path": "docs/server/overview.md",
    "chars": 1710,
    "preview": "# Overview\n\nEvery polly instance has a reference to a client-side server which you can leverage\nto gain full control of "
  },
  {
    "path": "docs/server/request.md",
    "chars": 6253,
    "preview": "# Request\n\n## Properties\n\n### method\n\n_Type_: `String`\n\nThe request method. (e.g. `GET`, `POST`, `DELETE`)\n\n### url\n\n_Ty"
  },
  {
    "path": "docs/server/response.md",
    "chars": 6068,
    "preview": "# Response\n\n## Properties\n\n### statusCode\n\n_Type_: `Number`\n_Default_: `undefined`\n\nThe response's status code.\n\n### hea"
  },
  {
    "path": "docs/server/route-handler.md",
    "chars": 10058,
    "preview": "# Route Handler\n\nAn object that is returned when calling any of the server's HTTP methods as well\nas `server.any()`.\n\n##"
  },
  {
    "path": "docs/test-frameworks/jest-jasmine.md",
    "chars": 702,
    "preview": "# Jest & Jasmine\n\nDue to the nature of the Jest & Jasmine APIs and their restrictions on accessing\nthe current running t"
  },
  {
    "path": "docs/test-frameworks/mocha.md",
    "chars": 3607,
    "preview": "# Mocha\n\nThe `@pollyjs/core` package provides a `setupMocha` utility which will setup\na new polly instance for each test"
  },
  {
    "path": "docs/test-frameworks/qunit.md",
    "chars": 2861,
    "preview": "# QUnit\n\nThe `@pollyjs/core` package provides a `setupQunit` utility which will setup\na new polly instance for each test"
  },
  {
    "path": "examples/.eslintrc.js",
    "chars": 69,
    "preview": "module.exports = {\n  env: {\n    node: true,\n    browser: true\n  }\n};\n"
  },
  {
    "path": "examples/client-server/index.html",
    "chars": 1046,
    "preview": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />"
  },
  {
    "path": "examples/client-server/package.json",
    "chars": 372,
    "preview": "{\n  \"name\": \"@pollyjs/client-server-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scr"
  },
  {
    "path": "examples/client-server/tests/events.test.js",
    "chars": 611,
    "preview": "/* global setupPolly */\n\ndescribe('Events', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister: 'local-"
  },
  {
    "path": "examples/client-server/tests/intercept.test.js",
    "chars": 1936,
    "preview": "/* global setupPolly */\n\ndescribe('Intercept', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister: 'loc"
  },
  {
    "path": "examples/client-server/tests/setup.js",
    "chars": 415,
    "preview": "// Expose common globals\nwindow.PollyJS = window['@pollyjs/core'];\nwindow.setupPolly = window.PollyJS.setupMocha;\nwindow"
  },
  {
    "path": "examples/dummy-app/.eslintrc.js",
    "chars": 124,
    "preview": "module.exports = {\n  extends: ['plugin:react/recommended'],\n  settings: {\n    react: {\n      version: '16.5.1'\n    }\n  }"
  },
  {
    "path": "examples/dummy-app/.gitignore",
    "chars": 285,
    "preview": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n\n# testing\n/cov"
  },
  {
    "path": "examples/dummy-app/README.md",
    "chars": 126912,
    "preview": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).\n\nBelow you"
  },
  {
    "path": "examples/dummy-app/package.json",
    "chars": 529,
    "preview": "{\n  \"name\": \"@pollyjs/dummy-app\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": "
  },
  {
    "path": "examples/dummy-app/public/index.html",
    "chars": 1606,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta\n      name=\"viewport\"\n      content=\"wi"
  },
  {
    "path": "examples/dummy-app/public/manifest.json",
    "chars": 321,
    "preview": "{\n  \"short_name\": \"Dummy App\",\n  \"name\": \"Polly.JS Examples Dummy App\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n "
  },
  {
    "path": "examples/dummy-app/src/App.js",
    "chars": 1386,
    "preview": "import React from 'react';\nimport { Admin, Resource } from 'react-admin';\nimport jsonServerProvider from 'ra-data-json-s"
  },
  {
    "path": "examples/dummy-app/src/index.css",
    "chars": 36,
    "preview": "body {\n  margin: 0;\n  padding: 0;\n}\n"
  },
  {
    "path": "examples/dummy-app/src/index.js",
    "chars": 169,
    "preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport './index.css';\nimport App from './App';\n\nReactDOM.r"
  },
  {
    "path": "examples/dummy-app/src/posts.js",
    "chars": 2516,
    "preview": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Edit,\n  Create,\n  Datagrid,\n  Referenc"
  },
  {
    "path": "examples/dummy-app/src/todos.js",
    "chars": 2555,
    "preview": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Edit,\n  Create,\n  Show,\n  Datagrid,\n  "
  },
  {
    "path": "examples/dummy-app/src/users.js",
    "chars": 948,
    "preview": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Datagrid,\n  EmailField,\n  TextField,\n "
  },
  {
    "path": "examples/jest-node-fetch/.eslintrc.js",
    "chars": 50,
    "preview": "module.exports = {\n  env: {\n    jest: true\n  }\n};\n"
  },
  {
    "path": "examples/jest-node-fetch/__recordings__/jest-node-fetch_1142061259/posts_1278140380/should-return-post_148615714/recording.har",
    "chars": 5065,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"jest-node-fetch/posts/should return post\",\n    \"creator\": {\n      \"comment\": \"persis"
  },
  {
    "path": "examples/jest-node-fetch/__recordings__/jest-node-fetch_1142061259/users_1585235219/should-return-user_4259424139/recording.har",
    "chars": 5319,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"jest-node-fetch/users/should return user\",\n    \"creator\": {\n      \"comment\": \"persis"
  },
  {
    "path": "examples/jest-node-fetch/__tests__/index.test.js",
    "chars": 1116,
    "preview": "const path = require('path');\n\nconst { Polly } = require('@pollyjs/core');\nconst { setupPolly } = require('setup-polly-j"
  },
  {
    "path": "examples/jest-node-fetch/package.json",
    "chars": 351,
    "preview": "{\n  \"name\": \"@pollyjs/jest-node-fetch-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"s"
  },
  {
    "path": "examples/jest-node-fetch/src/index.js",
    "chars": 79,
    "preview": "module.exports = {\n  posts: require('./posts'),\n  users: require('./users')\n};\n"
  },
  {
    "path": "examples/jest-node-fetch/src/posts.js",
    "chars": 199,
    "preview": "const fetch = require('node-fetch');\n\nmodule.exports = async (id) => {\n  const response = await fetch(\n    `https://json"
  },
  {
    "path": "examples/jest-node-fetch/src/users.js",
    "chars": 199,
    "preview": "const fetch = require('node-fetch');\n\nmodule.exports = async (id) => {\n  const response = await fetch(\n    `https://json"
  },
  {
    "path": "examples/jest-puppeteer/.eslintrc.js",
    "chars": 127,
    "preview": "module.exports = {\n  env: {\n    jest: true\n  },\n  globals: {\n    page: true,\n    browser: true,\n    jestPuppeteer: true\n"
  },
  {
    "path": "examples/jest-puppeteer/__recordings__/jest-puppeteer_2726822272/should-be-able-to-navigate-to-all-routes_1130491217/recording.har",
    "chars": 43468,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"jest-puppeteer/should be able to navigate to all routes\",\n    \"creator\": {\n      \"co"
  },
  {
    "path": "examples/jest-puppeteer/__tests__/dummy-app.test.js",
    "chars": 2007,
    "preview": "const path = require('path');\n\nconst { Polly } = require('@pollyjs/core');\nconst { setupPolly } = require('setup-polly-j"
  },
  {
    "path": "examples/jest-puppeteer/jest-puppeteer.config.js",
    "chars": 166,
    "preview": "module.exports = {\n  launch: {\n    headless: true\n  },\n  server: {\n    command: '(cd ../dummy-app && yarn start:ci)',\n  "
  },
  {
    "path": "examples/jest-puppeteer/jest.config.js",
    "chars": 49,
    "preview": "module.exports = {\n  preset: 'jest-puppeteer'\n};\n"
  },
  {
    "path": "examples/jest-puppeteer/package.json",
    "chars": 468,
    "preview": "{\n  \"name\": \"@pollyjs/jest-puppeteer-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"sc"
  },
  {
    "path": "examples/node-fetch/package.json",
    "chars": 356,
    "preview": "{\n  \"name\": \"@pollyjs/node-fetch-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"script"
  },
  {
    "path": "examples/node-fetch/recordings/node-fetch_2851505768/should-work_3457346403/recording.har",
    "chars": 5049,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"node-fetch/should work\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"na"
  },
  {
    "path": "examples/node-fetch/tests/node-fetch.test.js",
    "chars": 810,
    "preview": "const path = require('path');\n\nconst NodeHttpAdapter = require('@pollyjs/adapter-node-http');\nconst FSPersister = requir"
  },
  {
    "path": "examples/puppeteer/index.js",
    "chars": 1070,
    "preview": "const path = require('path');\n\nconst puppeteer = require('puppeteer');\nconst { Polly } = require('@pollyjs/core');\nconst"
  },
  {
    "path": "examples/puppeteer/package.json",
    "chars": 555,
    "preview": "{\n  \"name\": \"@pollyjs/puppeteer-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts"
  },
  {
    "path": "examples/puppeteer/recordings/puppeteer_2155046665/recording.har",
    "chars": 15334,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"puppeteer\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.J"
  },
  {
    "path": "examples/rest-persister/index.html",
    "chars": 983,
    "preview": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />"
  },
  {
    "path": "examples/rest-persister/package.json",
    "chars": 560,
    "preview": "{\n  \"name\": \"@pollyjs/rest-persister-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"sc"
  },
  {
    "path": "examples/rest-persister/recordings/REST-Persister_2289553200/should-work_3457346403/recording.har",
    "chars": 2157,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"REST Persister/should work\",\n    \"browser\": {\n      \"name\": \"Chrome\",\n      \"version"
  },
  {
    "path": "examples/rest-persister/tests/rest-persister.test.js",
    "chars": 369,
    "preview": "/* global setupPolly */\n\ndescribe('REST Persister', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister:"
  },
  {
    "path": "examples/rest-persister/tests/setup.js",
    "chars": 397,
    "preview": "// Expose common globals\nwindow.PollyJS = window['@pollyjs/core'];\nwindow.setupPolly = window.PollyJS.setupMocha;\nwindow"
  },
  {
    "path": "examples/typescript-jest-node-fetch/__recordings__/github-api-client_2139812550/getUser_1648904580/recording.har",
    "chars": 6560,
    "preview": "{\n  \"log\": {\n    \"_recordingName\": \"github-api client/getUser\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      "
  },
  {
    "path": "examples/typescript-jest-node-fetch/jest.config.ts",
    "chars": 381,
    "preview": "import type { Config } from \"@jest/types\";\n\nconst config: Config.InitialOptions = {\n  rootDir: \".\",\n  preset: \"ts-jest\","
  },
  {
    "path": "examples/typescript-jest-node-fetch/package.json",
    "chars": 1334,
    "preview": "{\n  \"name\": \"@pollyjs/typescript-jest-node-fetch-example\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"main\": \"./dist/in"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/github-api.test.ts",
    "chars": 937,
    "preview": "/** @jest-environment setup-polly-jest/jest-environment-node */\nimport autoSetupPolly from './utils/auto-setup-polly';\ni"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/github-api.ts",
    "chars": 539,
    "preview": "import fetch from \"node-fetch\";\nimport type { Response } from \"node-fetch\";\n\nexport const getUser = async (username: str"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/utils/auto-setup-polly.ts",
    "chars": 1228,
    "preview": "import path from \"path\";\nimport { setupPolly } from \"setup-polly-jest\";\nimport { Polly, PollyConfig } from \"@pollyjs/cor"
  },
  {
    "path": "examples/typescript-jest-node-fetch/tsconfig.json",
    "chars": 588,
    "preview": "{\n  \"compilerOptions\": {\n    \"target\": \"ES5\",\n    \"lib\": [\"esnext\"],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    "
  },
  {
    "path": "jest.config.js",
    "chars": 238,
    "preview": "/* eslint-env node */\n\nmodule.exports = {\n  testURL: 'http://localhost:4000/api',\n  testMatch: ['**/@pollyjs/*/build/jes"
  },
  {
    "path": "lerna.json",
    "chars": 606,
    "preview": "{\n  \"version\": \"6.0.7\",\n  \"npmClient\": \"yarn\",\n  \"useWorkspaces\": true,\n  \"packages\": [\"packages/@pollyjs/*\"],\n  \"comman"
  },
  {
    "path": "package.json",
    "chars": 3447,
    "preview": "{\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"repository\": \"https://github.com/netflix/pollyjs\",\n  \"contributors\": "
  },
  {
    "path": "packages/@pollyjs/adapter/CHANGELOG.md",
    "chars": 17595,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/adapter/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/adapter/README.md",
    "chars": 2366,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/adapter/package.json",
    "chars": 1174,
    "preview": "{\n  \"name\": \"@pollyjs/adapter\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Extendable base adapter class used by @pollyjs\","
  },
  {
    "path": "packages/@pollyjs/adapter/rollup.config.test.js",
    "chars": 229,
    "preview": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../"
  },
  {
    "path": "packages/@pollyjs/adapter/src/index.js",
    "chars": 8792,
    "preview": "import {\n  ACTIONS,\n  MODES,\n  EXPIRY_STRATEGIES,\n  PollyError,\n  Serializers,\n  assert\n} from '@pollyjs/utils';\n\nimport"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/dehumanize-time.js",
    "chars": 959,
    "preview": "const ALPHA_NUMERIC_DOT = /([0-9.]+)([a-zA-Z]+)/g;\nconst TIMES = {\n  ms: 1,\n  millisecond: 1,\n  milliseconds: 1,\n  s: 10"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/is-expired.js",
    "chars": 278,
    "preview": "import dehumanizeTime from './dehumanize-time';\n\nexport default function isExpired(recordedOn, expiresIn) {\n  if (record"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/normalize-recorded-response.js",
    "chars": 730,
    "preview": "const { isArray } = Array;\n\nexport default function normalizeRecordedResponse(response) {\n  const { status, statusText, "
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/stringify-request.js",
    "chars": 599,
    "preview": "export default function stringifyRequest(req, ...args) {\n  const config = { ...req.config };\n\n  // Remove all adapter & "
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/adapter-test.js",
    "chars": 161,
    "preview": "import Adapter from '../../src';\n\ndescribe('Unit | Adapter', function () {\n  it('should exist', function () {\n    expect"
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/utils/dehumanize-time-test.js",
    "chars": 1383,
    "preview": "import dehumanizeTime from '../../../src/utils/dehumanize-time';\n\ndescribe('Unit | Utils | dehumanizeTime', function () "
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/utils/is-expired-test.js",
    "chars": 677,
    "preview": "import isExpired from '../../../src/utils/is-expired';\n\ndescribe('Unit | Utils | isExpired', function () {\n  it('should "
  },
  {
    "path": "packages/@pollyjs/adapter/types.d.ts",
    "chars": 1627,
    "preview": "import { Polly, Request, Interceptor, Response } from '@pollyjs/core';\n\nexport default class Adapter<\n  TOptions extends"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/CHANGELOG.md",
    "chars": 17140,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/README.md",
    "chars": 1889,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/package.json",
    "chars": 1413,
    "preview": "{\n  \"name\": \"@pollyjs/adapter-fetch\",\n  \"version\": \"6.0.7\",\n  \"description\": \"Fetch adapter for @pollyjs\",\n  \"main\": \"di"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/rollup.config.test.js",
    "chars": 128,
    "preview": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createBrowserTestCon"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/src/index.js",
    "chars": 6462,
    "preview": "import Adapter from '@pollyjs/adapter';\nimport { cloneArrayBuffer, isBufferUtf8Representable } from '@pollyjs/utils';\nim"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/src/utils/serializer-headers.js",
    "chars": 384,
    "preview": "/**\n * Serialize a Headers instance into a pojo since it cannot be stringified.\n * @param {*} headers\n */\nexport default"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/adapter-test.js",
    "chars": 10752,
    "preview": "import { Polly, setupMocha as setupPolly } from '@pollyjs/core';\nimport { URL } from '@pollyjs/utils';\nimport setupFetch"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/persister-local-storage-test.js",
    "chars": 642,
    "preview": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport LocalStoragePersister from '@pollyjs/persister-local-st"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/persister-rest-test.js",
    "chars": 664,
    "preview": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport RESTPersister from '@pollyjs/persister-rest';\nimport se"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/server-test.js",
    "chars": 14327,
    "preview": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport { PollyError } from '@pollyjs/utils';\n\nimport pollyConf"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/utils/polly-config.js",
    "chars": 211,
    "preview": "import InMemoryPersister from '@pollyjs/persister-in-memory';\n\nimport FetchAdapter from '../../src';\n\nexport default {\n "
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/types.d.ts",
    "chars": 116,
    "preview": "import Adapter from '@pollyjs/adapter';\n\nexport default class FetchAdapter extends Adapter<{\n  context?: any;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/.eslintrc.js",
    "chars": 182,
    "preview": "module.exports = {\n  env: {\n    browser: false,\n    node: true\n  },\n  overrides: [\n    {\n      files: ['tests/jest/**/*."
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/CHANGELOG.md",
    "chars": 13446,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/README.md",
    "chars": 2086,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/package.json",
    "chars": 1472,
    "preview": "{\n  \"name\": \"@pollyjs/adapter-node-http\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Node HTTP adapter for @pollyjs\",\n  \"ma"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/rollup.config.js",
    "chars": 168,
    "preview": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nimport { external } from './rollup.config.shared';\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/rollup.config.shared.js",
    "chars": 109,
    "preview": "export const external = [\n  'http',\n  'https',\n  'url',\n  'stream',\n  'timers',\n  'tty',\n  'util',\n  'os'\n];\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/rollup.config.test.js",
    "chars": 381,
    "preview": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createJestTestConfig from '../../../"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/index.js",
    "chars": 9868,
    "preview": "import http from 'http';\nimport https from 'https';\nimport { URL } from 'url';\nimport { Readable as ReadableStream } fro"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/get-url-from-options.js",
    "chars": 777,
    "preview": "import { URL } from '@pollyjs/utils';\n\n/**\n * Generate an absolute url from options passed into `new http.ClientRequest`"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/merge-chunks.js",
    "chars": 630,
    "preview": "/**\n * Merge an array of strings into a single string or concat an array\n * of buffers into a single buffer.\n *\n * @expo"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/url-to-options.js",
    "chars": 859,
    "preview": "/**\n * Utility function that converts a URL object into an ordinary\n * options object as expected by the http.request an"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/adapter-node-fetch-test.js",
    "chars": 618,
    "preview": "import '@pollyjs-tests/helpers/global-node-fetch';\n\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-rec"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/adapter-test.js",
    "chars": 6042,
    "preview": "import fs from 'fs';\nimport http from 'http';\nimport https from 'https';\nimport path from 'path';\n\nimport FormData from "
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/persister-fs-test.js",
    "chars": 846,
    "preview": "import http from 'http';\n\nimport setupPersister from '@pollyjs-tests/helpers/setup-persister';\nimport setupFetchRecord f"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/jest/integration/fetch-test.js",
    "chars": 989,
    "preview": "import '@pollyjs-tests/helpers/global-node-fetch';\n\nimport { Polly } from '@pollyjs/core';\n\nimport pollyConfig from '../"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/jest/integration/xhr-test.js",
    "chars": 1197,
    "preview": "import { Polly } from '@pollyjs/core';\n\nimport pollyConfig from '../../utils/polly-config';\n\nfunction request(url) {\n  r"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/unit/utils/merge-chunks-test.js",
    "chars": 747,
    "preview": "import mergeChunks from '../../../src/utils/merge-chunks';\n\ndescribe('Unit | Utils | mergeChunks', function () {\n  it('s"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/get-buffer-from-stream.js",
    "chars": 267,
    "preview": "export default function getBufferFromStream(stream) {\n  return new Promise((resolve) => {\n    const chunks = [];\n\n    st"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/get-response-from-request.js",
    "chars": 229,
    "preview": "export default function getResponseFromRequest(req, data) {\n  return new Promise((resolve, reject) => {\n    req.once('re"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/native-request.js",
    "chars": 558,
    "preview": "import Url from 'url';\n\nimport { Response } from 'node-fetch';\n\nimport getResponseFromRequest from './get-response-from-"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/polly-config.js",
    "chars": 241,
    "preview": "import InMemoryPersister from '@pollyjs/persister-in-memory';\n\nimport NodeHttpAdapter from '../../src';\n\nexport default "
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/types.d.ts",
    "chars": 97,
    "preview": "import Adapter from '@pollyjs/adapter';\n\nexport default class NodeHttpAdapter extends Adapter {}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/CHANGELOG.md",
    "chars": 13982,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/README.md",
    "chars": 2321,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/package.json",
    "chars": 1352,
    "preview": "{\n  \"name\": \"@pollyjs/adapter-puppeteer\",\n  \"version\": \"6.0.6\",\n  \"description\": \"File system persister for @pollyjs\",\n "
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/rollup.config.js",
    "chars": 104,
    "preview": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nexport default createNodeConfig();\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/rollup.config.test.js",
    "chars": 146,
    "preview": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\n\nexport default createNodeTestConfig({\n  ex"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/src/index.js",
    "chars": 7343,
    "preview": "import Adapter from '@pollyjs/adapter';\nimport { URL } from '@pollyjs/utils';\n\nconst LISTENERS = Symbol();\nconst PASSTHR"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/helpers/fetch.js",
    "chars": 504,
    "preview": "import { Response } from 'node-fetch';\n\nexport default async function fetch() {\n  const res = await this.page.evaluate(("
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/integration/adapter-test.js",
    "chars": 2980,
    "preview": "import InMemoryPersister from '@pollyjs/persister-in-memory';\nimport puppeteer from 'puppeteer';\nimport setupFetchRecord"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/unit/adapter-test.js",
    "chars": 445,
    "preview": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport { PollyError } from '@pollyjs/utils';\n\nimport Puppeteer"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/types.d.ts",
    "chars": 151,
    "preview": "import Adapter from '@pollyjs/adapter';\n\nexport default class PuppeteerAdapter extends Adapter<{\n  page: any;\n  requestR"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/CHANGELOG.md",
    "chars": 11783,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/README.md",
    "chars": 1979,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/package.json",
    "chars": 1383,
    "preview": "{\n  \"name\": \"@pollyjs/adapter-xhr\",\n  \"version\": \"6.0.6\",\n  \"description\": \"XHR adapter for @pollyjs\",\n  \"main\": \"dist/c"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/rollup.config.test.js",
    "chars": 128,
    "preview": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createBrowserTestCon"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/index.js",
    "chars": 4796,
    "preview": "import fakeXhr from '@offirgolan/nise/lib/fake-xhr';\nimport Adapter from '@pollyjs/adapter';\nimport { cloneArrayBuffer, "
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/utils/resolve-xhr.js",
    "chars": 399,
    "preview": "export default function resolveXhr(xhr, body) {\n  return new Promise((resolve) => {\n    xhr.send(body);\n\n    if (xhr.asy"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/utils/serialize-response-headers.js",
    "chars": 488,
    "preview": "/**\n * Serialize response headers which is received as a string, into a pojo\n *\n * @param {String} responseHeaders\n */\ne"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/tests/integration/adapter-test.js",
    "chars": 4910,
    "preview": "import { Polly, setupMocha as setupPolly } from '@pollyjs/core';\nimport setupFetchRecord from '@pollyjs-tests/helpers/se"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/tests/utils/xhr-request.js",
    "chars": 932,
    "preview": "import serializeResponseHeaders from '../../src/utils/serialize-response-headers';\n\nexport default function request(url,"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/types.d.ts",
    "chars": 114,
    "preview": "import Adapter from '@pollyjs/adapter';\n\nexport default class XHRAdapter extends Adapter<{\n  context?: any;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/cli/.eslintrc.js",
    "chars": 203,
    "preview": "module.exports = {\n  parserOptions: {\n    sourceType: 'script',\n    ecmaVersion: 2020\n  },\n  env: {\n    browser: false,\n"
  },
  {
    "path": "packages/@pollyjs/cli/CHANGELOG.md",
    "chars": 5998,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/cli/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/cli/README.md",
    "chars": 1837,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/cli/bin/cli.js",
    "chars": 1095,
    "preview": "#!/usr/bin/env node\n\n// Provide a title to the process in `ps`\nprocess.title = 'polly';\n\nconst Polly = require('@pollyjs"
  },
  {
    "path": "packages/@pollyjs/cli/package.json",
    "chars": 794,
    "preview": "{\n  \"name\": \"@pollyjs/cli\",\n  \"version\": \"6.0.6\",\n  \"description\": \"@pollyjs CLI\",\n  \"files\": [\n    \"bin\"\n  ],\n  \"reposi"
  },
  {
    "path": "packages/@pollyjs/core/CHANGELOG.md",
    "chars": 30996,
    "preview": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://co"
  },
  {
    "path": "packages/@pollyjs/core/LICENSE",
    "chars": 11367,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "packages/@pollyjs/core/README.md",
    "chars": 6272,
    "preview": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-log"
  },
  {
    "path": "packages/@pollyjs/core/package.json",
    "chars": 1547,
    "preview": "{\n  \"name\": \"@pollyjs/core\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Record, replay, and stub HTTP Interactions\",\n  \"mai"
  },
  {
    "path": "packages/@pollyjs/core/rollup.config.test.js",
    "chars": 229,
    "preview": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/container.js",
    "chars": 1813,
    "preview": "import { assert } from '@pollyjs/utils';\n\nfunction keyFor(Factory) {\n  return `${Factory.type}:${Factory.id}`;\n}\n\nexport"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/event-emitter.js",
    "chars": 7902,
    "preview": "import { assert } from '@pollyjs/utils';\nimport isObjectLike from 'lodash-es/isObjectLike';\n\nimport cancelFnAfterNTimes "
  },
  {
    "path": "packages/@pollyjs/core/src/-private/event.js",
    "chars": 614,
    "preview": "import { assert } from '@pollyjs/utils';\n\nconst STOP_PROPAGATION = Symbol();\n\nexport default class Event {\n  constructor"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/http-base.js",
    "chars": 1852,
    "preview": "import stringify from 'fast-json-stable-stringify';\n\nimport HTTPHeaders from '../utils/http-headers';\n\nconst { freeze } "
  },
  {
    "path": "packages/@pollyjs/core/src/-private/interceptor.js",
    "chars": 652,
    "preview": "import Event from './event';\n\nconst ABORT = Symbol();\nconst PASSTHROUGH = Symbol();\n\nfunction setDefaults(interceptor) {"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/logger.js",
    "chars": 1651,
    "preview": "import { ACTIONS } from '@pollyjs/utils';\nimport logLevel from 'loglevel';\n\nconst FORMATTED_ACTIONS = {\n  [ACTIONS.RECOR"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/request.js",
    "chars": 7506,
    "preview": "import md5 from 'blueimp-md5';\nimport stringify from 'fast-json-stable-stringify';\nimport isAbsoluteUrl from 'is-absolut"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/response.js",
    "chars": 975,
    "preview": "import { assert, HTTP_STATUS_CODES } from '@pollyjs/utils';\n\nimport HTTPBase from './http-base';\n\nconst DEFAULT_STATUS_C"
  },
  {
    "path": "packages/@pollyjs/core/src/defaults/config.js",
    "chars": 817,
    "preview": "import { MODES, EXPIRY_STRATEGIES } from '@pollyjs/utils';\nimport logLevel from 'loglevel';\n\nimport Timing from '../util"
  },
  {
    "path": "packages/@pollyjs/core/src/index.js",
    "chars": 221,
    "preview": "export { default as Polly } from './polly';\nexport { default as Timing } from './utils/timing';\n\nexport { default as set"
  },
  {
    "path": "packages/@pollyjs/core/src/polly.js",
    "chars": 7234,
    "preview": "import { MODES, assert } from '@pollyjs/utils';\n\nimport { version } from '../package.json';\n\nimport Logger from './-priv"
  },
  {
    "path": "packages/@pollyjs/core/src/server/handler.js",
    "chars": 2447,
    "preview": "import { assert } from '@pollyjs/utils';\n\nimport EventEmitter from '../-private/event-emitter';\nimport cancelFnAfterNTim"
  },
  {
    "path": "packages/@pollyjs/core/src/server/index.js",
    "chars": 5263,
    "preview": "import RouteRecognizer from 'route-recognizer';\nimport castArray from 'lodash-es/castArray';\nimport { HTTP_METHODS, URL,"
  },
  {
    "path": "packages/@pollyjs/core/src/server/middleware.js",
    "chars": 777,
    "preview": "import RouteRecognizer from 'route-recognizer';\n\nimport Route from './route';\n\nconst GLOBAL = '__GLOBAL__';\n\nexport defa"
  }
]

// ... and 193 more files (download for full content)

About this extraction

This page contains the full source code of the Netflix/pollyjs GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 393 files (1.1 MB), approximately 315.1k tokens, and a symbol index with 585 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!