[
  {
    "path": ".commitlintrc.js",
    "content": "/* eslint-env node */\n\nmodule.exports = {\n  extends: [\n    '@commitlint/config-lerna-scopes',\n    '@commitlint/config-conventional'\n  ],\n  rules: {\n    'subject-case': [2, 'always', ['sentence-case']]\n  }\n};\n"
  },
  {
    "path": ".eslintignore",
    "content": "/packages/@pollyjs/ember/tests/**/index.html\nCHANGELOG.md\npackage.json\nnode_modules\ntmp\nbuild\ndist\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "/* eslint-env node */\n\nmodule.exports = {\n  root: true,\n  parserOptions: {\n    ecmaVersion: 2018,\n    sourceType: 'module'\n  },\n  plugins: ['import'],\n  extends: ['eslint:recommended', 'plugin:prettier/recommended'],\n  globals: {\n    global: true\n  },\n  env: {\n    browser: true,\n    es6: true\n  },\n  rules: {\n    'no-console': 'off',\n    'prefer-const': 'error',\n    'getter-return': 'error',\n    'padding-line-between-statements': [\n      'error',\n      // require blank lines before all return statements,\n      { blankLine: 'always', prev: '*', next: 'return' },\n\n      // Require blank lines after every sequence of variable declarations\n      { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },\n      {\n        blankLine: 'any',\n        prev: ['const', 'let', 'var'],\n        next: ['const', 'let', 'var']\n      }\n    ],\n    'no-restricted-properties': [\n      2,\n      {\n        object: 'Object',\n        property: 'assign',\n        message: 'Please use the spread operator instead.'\n      }\n    ],\n    // Require that imports occur at the top of the file\n    'import/first': 'error',\n\n    // Require imports to be grouped and ordered consistently\n    'import/order': [\n      'error',\n      {\n        'newlines-between': 'always'\n      }\n    ]\n  },\n  overrides: [\n    // test files\n    {\n      files: ['tests/**/*.js', '**/*/tests/**/*.js'],\n      env: {\n        mocha: true\n      },\n      globals: {\n        chai: true,\n        expect: true\n      }\n    },\n    {\n      files: ['**/*/tests/node/**/*.js'],\n      env: {\n        browser: false\n      }\n    },\n    {\n      files: ['**/*/tests/jest/**/*.js'],\n      env: {\n        jest: true,\n        mocha: false\n      }\n    }\n  ]\n};\n"
  },
  {
    "path": ".github/issue_template.md",
    "content": "## Prerequisites\n\n- 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.\n- Read the [contributing guidelines](https://github.com/Netflix/pollyjs/blob/master/CONTRIBUTING.md).\n- Ensure the issue isn't already reported.\n- Should be reproducible with the latest @pollyjs package versions.\n\n> _Delete the above section and the instructions in the sections below before submitting_\n\n## Description\n\nIf this is a feature request, explain why it should be added. Specific use-cases are best.\n\nFor bug reports, please provide as much _relevant_ info as possible.\n\n### Shareable Source\n\n```js\n// Avoid posting hundreds of lines of source code.\n// Edit to just the relevant portions.\n```\n\n### Error Message & Stack Trace\n\n```\nCOPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE\n```\n\n### Config\n\nCopy the config used to setup the Polly instance:\n\n```js\nnew Polly('Recording Name', {\n  // config...\n});\n```\n\n### Dependencies\n\nCopy the @pollyjs dependencies from `package.json`:\n\n```json\n{\n  \"@pollyjs/core\": \"latest\",\n  \"@pollyjs/adapter-x\": \"latest\",\n  \"@pollyjs/persister-x\": \"latest\"\n}\n```\n\n## Relevant Links\n\n- If your project is public, link to the repo so we can investigate directly.\n- **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support.\n\n## Environment\n\nTell 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.\n\nRun the following to get it quickly:\n\n```\nnode -e \"var os=require('os');console.log('Node.js ' + process.version + '\\n' + os.platform() + ' ' + os.release())\"\nnpm --version\nyarn --version\n```\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "<!--- Provide a general summary of your changes in the Title above -->\n\n## Description\n\n<!--- Describe your changes in detail -->\n\n## Motivation and Context\n\n<!---\n  Why is this change required? What problem does it solve?\n\n  If it fixes an open issue, please link to the issue here.\n-->\n\n## Types of Changes\n\n<!---\n  What types of changes does your code introduce? Put an `x` in all the boxes that apply:\n-->\n\n- [ ] Bug fix (non-breaking change which fixes an issue)\n- [ ] New feature (non-breaking change which adds functionality)\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\n\n## Checklist\n\n<!---\n  Go over all the following points, and put an `x` in all the boxes that apply.\n\n  If you're unsure about any of these, don't hesitate to ask. We're here to help!\n-->\n\n- [ ] I have added tests to cover my changes.\n- [ ] My change requires a change to the documentation.\n- [ ] I have updated the documentation accordingly.\n- [ ] My code follows the code style of this project.\n- [ ] My commits and the title of this PR follow the [Conventional Commits Specification](https://www.conventionalcommits.org).\n- [ ] I have read the [contributing guidelines](https://github.com/Netflix/pollyjs/blob/master/CONTRIBUTING.md).\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\nnode_modules\npackage-lock.json\nlerna-debug.log\npackages/**/dist/\nyarn-error.log\ntmp\nbuild\ndist\n*.lerna_backup\n.npmrc\n\n# Test recordings can write be written here if the test job did not\n# get a chance to run to completion.  The test will cleans these files up afterwards.\n/recordings\n\n# Examples\nexamples/**/*/yarn.lock\n\n# IDE\n.vscode/\n.tool-versions\n"
  },
  {
    "path": ".husky/commit-msg",
    "content": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nyarn commitlint --edit \"$1\"\n"
  },
  {
    "path": ".husky/pre-commit",
    "content": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nyarn lint-staged\n"
  },
  {
    "path": ".mocharc.js",
    "content": "module.exports = {\n  spec: './packages/@pollyjs/*/build/node/*.js',\n  ui: 'bdd',\n  require: 'tests/node-setup.js'\n};\n"
  },
  {
    "path": ".prettierrc.js",
    "content": "'use strict';\n\nmodule.exports = {\n  singleQuote: true,\n  trailingComma: 'none'\n};\n"
  },
  {
    "path": ".travis.yml",
    "content": "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  - curl -o- -L https://yarnpkg.com/install.sh | bash\n  - export PATH=$HOME/.yarn/bin:$PATH\n\ninstall:\n  - yarn install --frozen-lockfile --non-interactive\n\nscript:\n  - commitlint-travis\n  - yarn run test:ci\n  - ./scripts/require-clean-work-tree.sh\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.7](https://github.com/netflix/pollyjs/compare/v6.0.6...v6.0.7) (2025-05-31)\n\n\n### Bug Fixes\n\n* 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))\n\n\n\n\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package pollyjs\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n\n### Bug Fixes\n\n* **persister:** `requests` -> `request` in `HarEntry` declaration ([#441](https://github.com/netflix/pollyjs/issues/441)) ([6466810](https://github.com/netflix/pollyjs/commit/6466810677b6ac2c6a7496335bf40e043ab843e1))\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n\n### Bug Fixes\n\n* Update types for class methods ([#438](https://github.com/netflix/pollyjs/issues/438)) ([b88655a](https://github.com/netflix/pollyjs/commit/b88655ac1b4ca7348afd45e9aeaa50e998ea68d7))\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n\n### Bug Fixes\n\n* A few more type fixes ([#437](https://github.com/netflix/pollyjs/issues/437)) ([5e837a2](https://github.com/netflix/pollyjs/commit/5e837a25d28393b764cb66bcae0b29e9273eabe8))\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n\n### Bug Fixes\n\n* **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ([cc2fa19](https://github.com/netflix/pollyjs/commit/cc2fa197a5c0a5fdef4602c4a207d31f3e677897))\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **ember:** Bump peer dependencies to 6.x ([#432](https://github.com/netflix/pollyjs/issues/432)) ([1529226](https://github.com/netflix/pollyjs/commit/152922688744c8a2f8d89f793dcecf3c2bc40033))\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n### Bug Fixes\n\n* **persister:** Only treat status codes >= 400 as failed ([#430](https://github.com/netflix/pollyjs/issues/430)) ([7658952](https://github.com/netflix/pollyjs/commit/765895232746cd560da6bd566de8a312045b1703))\n\n\n* fix!: Upgrade url-parse (#426) ([c21ed04](https://github.com/netflix/pollyjs/commit/c21ed048ff9d87a3773458dcfb9758e4fa6582bf)), closes [#426](https://github.com/netflix/pollyjs/issues/426)\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### Features\n\n* **adapter-node-http:** Upgrade nock to v13 ([#424](https://github.com/netflix/pollyjs/issues/424)) ([2d5b59e](https://github.com/netflix/pollyjs/commit/2d5b59ee0c33ea53a64321249246fcae0a616a3f))\n* **node-server:** Upgrade dependencies ([#417](https://github.com/netflix/pollyjs/issues/417)) ([246a2f2](https://github.com/netflix/pollyjs/commit/246a2f29a88de9c25fc0739ea5e53a0130a58573))\n\n\n### BREAKING CHANGES\n\n* Upgrade url-parse to 1.5.0+ to fix CVE-2021-27515. This change could alter the final url generated for a request. \n* Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n* Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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. \n* Recording file name will no longer have trailing dashes\n* 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.\n\t* Although backwards compatibility is not guaranteed, you can replace all occurrences of `\"_isBinary\": true` with `\"encoding\": \"hex\"` in the recorded HAR files.\n* @pollyjs dependencies for @pollyjs/ember have been moved to peer dependencies\n\n\n\n\n\n# [5.2.0](https://github.com/netflix/pollyjs/compare/v5.1.1...v5.2.0) (2021-11-24)\n\n\n### Features\n\n* **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))\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n\n### Bug Fixes\n\n* Handle failed arraybuffer instanceof checks ([#393](https://github.com/netflix/pollyjs/issues/393)) ([247be0a](https://github.com/netflix/pollyjs/commit/247be0a))\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n\n### Bug Fixes\n\n* **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))\n\n\n### Features\n\n* **core:** Add `overrideRecordingName` and `configure` to public API ([#372](https://github.com/netflix/pollyjs/issues/372)) ([cdbf513](https://github.com/netflix/pollyjs/commit/cdbf513))\n\n\n\n\n\n## [5.0.2](https://github.com/netflix/pollyjs/compare/v5.0.1...v5.0.2) (2020-12-06)\n\n\n### Bug Fixes\n\n* **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))\n\n\n\n\n\n## [5.0.1](https://github.com/netflix/pollyjs/compare/v5.0.0...v5.0.1) (2020-09-25)\n\n\n### Bug Fixes\n\n* **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))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Add statusText to the response ([#341](https://github.com/netflix/pollyjs/issues/341)) ([0d45953](https://github.com/netflix/pollyjs/commit/0d45953))\n* **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))\n\n\n### Features\n\n* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/commit/1223ba0))\n\n\n### BREAKING CHANGES\n\n* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id\n* **core:** A request's order is will now be computed based on its id and the recording name it will be persisted to.\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **adapter-fetch:** Add support for handling binary data ([#332](https://github.com/netflix/pollyjs/issues/332)) ([111bebf](https://github.com/netflix/pollyjs/commit/111bebf))\n* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/commit/48ea1d7))\n* **core:** Add `flushRequestsOnStop` configuration option ([#335](https://github.com/netflix/pollyjs/issues/335)) ([ab4a2e1](https://github.com/netflix/pollyjs/commit/ab4a2e1))\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/issues/329)) ([9466989](https://github.com/netflix/pollyjs/commit/9466989))\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n\n### Features\n\n* **node-server:** Pass options to the CORS middleware via `corsOptions` ([3d991f5](https://github.com/netflix/pollyjs/commit/3d991f5))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/commit/cc46bb4))\n* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/commit/8fd4d19))\n\n\n### Features\n\n* **persister:** Add `disableSortingHarEntries` option ([#321](https://github.com/netflix/pollyjs/issues/321)) ([0003c0e](https://github.com/netflix/pollyjs/commit/0003c0e))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/commit/41dd093))\n* **adapter-node-http:** Bump nock version ([#319](https://github.com/netflix/pollyjs/issues/319)) ([7d361a6](https://github.com/netflix/pollyjs/commit/7d361a6))\n\n\n\n\n\n## [4.0.3](https://github.com/netflix/pollyjs/compare/v4.0.2...v4.0.3) (2020-01-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Use requestBodyBuffers to parse body ([#304](https://github.com/netflix/pollyjs/issues/304)) ([113fec5](https://github.com/netflix/pollyjs/commit/113fec5))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n\n### Bug Fixes\n\n* **core:** Strict null query param handling ([#302](https://github.com/netflix/pollyjs/issues/302)) ([5cf70aa](https://github.com/netflix/pollyjs/commit/5cf70aa))\n\n\n\n\n\n## [4.0.1](https://github.com/netflix/pollyjs/compare/v4.0.0...v4.0.1) (2020-01-25)\n\n\n### Bug Fixes\n\n* **ember:** Config read from project root ([7d6da38](https://github.com/netflix/pollyjs/commit/7d6da38))\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### Bug Fixes\n\n* **adapter:** Clone the recording entry before mutating it ([#294](https://github.com/netflix/pollyjs/issues/294)) ([d7e1303](https://github.com/netflix/pollyjs/commit/d7e1303))\n* **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))\n\n\n### chore\n\n* Drop node 8 support ([#292](https://github.com/netflix/pollyjs/issues/292)) ([4448be5](https://github.com/netflix/pollyjs/commit/4448be5))\n\n\n### Features\n\n* **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))\n* **core:** Remove deprecated `recordIfExpired` option ([#295](https://github.com/netflix/pollyjs/issues/295)) ([5fe991d](https://github.com/netflix/pollyjs/commit/5fe991d))\n\n\n### BREAKING CHANGES\n\n* **core:** `recordIfExpired` is no longer supported, please use `expiryStrategy` instead.\n* Drop support for Node 8 as it is now EOL\n* **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.\n\n\n\n\n\n## [3.0.2](https://github.com/netflix/pollyjs/compare/v3.0.1...v3.0.2) (2020-01-08)\n\n\n### Bug Fixes\n\n* **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)\n\n\n\n\n\n## [3.0.1](https://github.com/netflix/pollyjs/compare/v3.0.0...v3.0.1) (2019-12-25)\n\n\n### Bug Fixes\n\n* **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)\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n\n### Bug Fixes\n\n* **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))\n\n\n### BREAKING CHANGES\n\n* **ember:** moves location of polly configuration\n\n\n\n\n\n# [2.7.0](https://github.com/netflix/pollyjs/compare/v2.6.3...v2.7.0) (2019-11-21)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Correctly handle uploading binary data ([#257](https://github.com/netflix/pollyjs/issues/257)) ([31f0e0a](https://github.com/netflix/pollyjs/commit/31f0e0a))\n\n\n### Features\n\n* **adapter-node-http:** Upgrade nock to v11.x ([#273](https://github.com/netflix/pollyjs/issues/273)) ([5d42cbd](https://github.com/netflix/pollyjs/commit/5d42cbd))\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/commit/5b4edf3))\n* **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))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Bug Fixes\n\n* Bowser.getParser empty string UserAgent error ([#246](https://github.com/netflix/pollyjs/issues/246)) ([2c9c4b9](https://github.com/netflix/pollyjs/commit/2c9c4b9))\n\n\n### Features\n\n* 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))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n\n### Bug Fixes\n\n* **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))\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Handle `Request` objects as URLs ([#220](https://github.com/netflix/pollyjs/issues/220)) ([bb28d54](https://github.com/netflix/pollyjs/commit/bb28d54))\n\n\n### Features\n\n* **core:** Improved logging ([#217](https://github.com/netflix/pollyjs/issues/217)) ([3e876a8](https://github.com/netflix/pollyjs/commit/3e876a8))\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/commit/23a2127))\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n\n### Features\n\n* **adapter-xhr:** Support `context` option ([65b3c38](https://github.com/netflix/pollyjs/commit/65b3c38))\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n\n### Features\n\n* **core:** Improved control flow with `times` and `stopPropagation` ([#202](https://github.com/netflix/pollyjs/issues/202)) ([2c8231e](https://github.com/netflix/pollyjs/commit/2c8231e))\n\n\n\n\n\n## [2.3.2](https://github.com/netflix/pollyjs/compare/v2.3.1...v2.3.2) (2019-04-09)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Remove other resource type matching ([#197](https://github.com/netflix/pollyjs/issues/197)) ([ea6bfcc](https://github.com/netflix/pollyjs/commit/ea6bfcc))\n\n\n\n\n\n## [2.3.1](https://github.com/netflix/pollyjs/compare/v2.3.0...v2.3.1) (2019-03-06)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Correctly handle key/value pairs headers ([dc0323d](https://github.com/netflix/pollyjs/commit/dc0323d))\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n\n### Features\n\n* **core:** Filter requests matched by a route handler ([#189](https://github.com/netflix/pollyjs/issues/189)) ([5d57c32](https://github.com/netflix/pollyjs/commit/5d57c32))\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n\n### Bug Fixes\n\n* **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))\n* **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))\n* Correctly handle array header values ([#179](https://github.com/netflix/pollyjs/issues/179)) ([fb7dbb4](https://github.com/netflix/pollyjs/commit/fb7dbb4))\n\n\n### Features\n\n* **core:** Add removeHeader, removeHeaders, and allow empty headers ([#176](https://github.com/netflix/pollyjs/issues/176)) ([1dfae5a](https://github.com/netflix/pollyjs/commit/1dfae5a))\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n*  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)\n\n\n### Bug Fixes\n\n* **adapter:** Test for navigator before accessing ([#165](https://github.com/netflix/pollyjs/issues/165)) ([7200255](https://github.com/netflix/pollyjs/commit/7200255))\n* **ember:** Remove Node 6 from supported versions ([#169](https://github.com/netflix/pollyjs/issues/169)) ([07b2b4e](https://github.com/netflix/pollyjs/commit/07b2b4e))\n* **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))\n\n\n### chore\n\n* Remove support for Node 6 ([#167](https://github.com/netflix/pollyjs/issues/167)) ([a08a8cf](https://github.com/netflix/pollyjs/commit/a08a8cf))\n\n\n### Features\n\n* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/commit/5b07b26))\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/commit/12c8601))\n\n\n### BREAKING CHANGES\n\n* The node-http adapter no longer accepts the `transports` option\n* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).\n* Polly will no longer actively support Node 6\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n\n### Bug Fixes\n\n* **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))\n* **adapter-node-http:** Pause socket on original request ([#162](https://github.com/netflix/pollyjs/issues/162)) ([8f0c56c](https://github.com/netflix/pollyjs/commit/8f0c56c))\n\n\n### Features\n\n* Lint other filetypes with prettier ([#152](https://github.com/netflix/pollyjs/issues/152)) ([78d1af8](https://github.com/netflix/pollyjs/commit/78d1af8))\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n\n### Bug Fixes\n\n* **utils:** Support arrays & nested objects in query params ([#148](https://github.com/netflix/pollyjs/issues/148)) ([7e846b0](https://github.com/netflix/pollyjs/commit/7e846b0))\n\n\n\n\n\n# [1.4.0](https://github.com/netflix/pollyjs/compare/v1.3.2...v1.4.0) (2018-12-07)\n\n\n### Bug Fixes\n\n* **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))\n\n\n### Features\n\n* Node HTTP Adapter ([#128](https://github.com/netflix/pollyjs/issues/128)) ([fa059a4](https://github.com/netflix/pollyjs/commit/fa059a4))\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package pollyjs\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Bug Fixes\n\n* Support URL objects ([#139](https://github.com/netflix/pollyjs/issues/139)) ([cf0d755](https://github.com/netflix/pollyjs/commit/cf0d755))\n* **core:** Handle trailing slashes when generating route names ([#142](https://github.com/netflix/pollyjs/issues/142)) ([19147f7](https://github.com/netflix/pollyjs/commit/19147f7))\n* **core:** Ignore `context` options from being deep merged ([#144](https://github.com/netflix/pollyjs/issues/144)) ([2123d83](https://github.com/netflix/pollyjs/commit/2123d83))\n* **core:** Support multiple handlers for same paths ([#141](https://github.com/netflix/pollyjs/issues/141)) ([79e04b8](https://github.com/netflix/pollyjs/commit/79e04b8))\n\n\n### Features\n\n* **core:** Support custom functions in matchRequestsBy config options ([#138](https://github.com/netflix/pollyjs/issues/138)) ([626a84c](https://github.com/netflix/pollyjs/commit/626a84c))\n* 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))\n\n\n\n\n\n      <a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/commit/53ad433))\n* 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))\n* **core:** Freeze request after emitting afterResponse. ([66a2b64](https://github.com/netflix/pollyjs/commit/66a2b64))\n* Allow 204 responses without a body ([#101](https://github.com/netflix/pollyjs/issues/101)) ([20b4125](https://github.com/netflix/pollyjs/commit/20b4125))\n* Browser (UMD) build now bundles corejs ([#106](https://github.com/netflix/pollyjs/issues/106)) ([ec62fc0](https://github.com/netflix/pollyjs/commit/ec62fc0))\n* Bumping core within Ember ([af4faa1](https://github.com/netflix/pollyjs/commit/af4faa1))\n* Config expiresIn can contain periods. i.e, 1.5 weeks ([e9c7aaa](https://github.com/netflix/pollyjs/commit/e9c7aaa))\n* Correctly normalize relative URLs ([b9b23cd](https://github.com/netflix/pollyjs/commit/b9b23cd))\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/commit/19fee5a))\n* Do not display node server listening banner in quiet mode ([1be57a7](https://github.com/netflix/pollyjs/commit/1be57a7))\n* 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))\n* 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)\n* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/commit/79cdd96))\n* Proxy route.params onto the request instead of mutating req ([5bcd4f9](https://github.com/netflix/pollyjs/commit/5bcd4f9))\n* Puppeteer 1.7.0 support ([#100](https://github.com/netflix/pollyjs/issues/100)) ([e208b38](https://github.com/netflix/pollyjs/commit/e208b38))\n* Puppeteer CORS request matching ([#110](https://github.com/netflix/pollyjs/issues/110)) ([7831115](https://github.com/netflix/pollyjs/commit/7831115))\n* Rest server on Windows ([be5c473](https://github.com/netflix/pollyjs/commit/be5c473))\n* **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)\n* **ember:** Fix auto-register and add tests to cover ([24c15bd](https://github.com/netflix/pollyjs/commit/24c15bd))\n* **persister:** Handle concurrent find requests ([#88](https://github.com/netflix/pollyjs/issues/88)) ([0e02414](https://github.com/netflix/pollyjs/commit/0e02414))\n\n\n### Features\n\n* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/commit/4ebacb8))\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/commit/0a3d591))\n* Cleanup event handler logic + rename some event names ([78dbb5d](https://github.com/netflix/pollyjs/commit/78dbb5d))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/issues/45)) ([e622640](https://github.com/netflix/pollyjs/commit/e622640))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/commit/8bb313c))\n* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/commit/82ebd09))\n* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/commit/164dbac))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/commit/29ed8e1))\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/commit/d4be431))\n* Move more response methods to shared base class ([#74](https://github.com/netflix/pollyjs/issues/74)) ([4f845e5](https://github.com/netflix/pollyjs/commit/4f845e5))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/commit/0b47838))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/commit/f902c6d))\n* Use status code 204 in place of 404. ([#5](https://github.com/netflix/pollyjs/issues/5)) ([930c492](https://github.com/netflix/pollyjs/commit/930c492))\n* **core:** Add `json` property to `Request` ([bb8e1cb](https://github.com/netflix/pollyjs/commit/bb8e1cb)), closes [#7](https://github.com/netflix/pollyjs/issues/7)\n* **core:** Default `Response` status code to 200 ([f42a281](https://github.com/netflix/pollyjs/commit/f42a281)), closes [#6](https://github.com/netflix/pollyjs/issues/6)\n* 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))\n* **core:** Normalize headers by lower-casing all keys ([#42](https://github.com/netflix/pollyjs/issues/42)) ([02a4767](https://github.com/netflix/pollyjs/commit/02a4767))\n* **core:** Server level configuration ([#80](https://github.com/netflix/pollyjs/issues/80)) ([0f32d9b](https://github.com/netflix/pollyjs/commit/0f32d9b))\n* **node-server:** Add cors support to express server to pass-through all requests ([223ce4e](https://github.com/netflix/pollyjs/commit/223ce4e))\n* **persister:** Add `keepUnusedRequests` config option ([#108](https://github.com/netflix/pollyjs/issues/108)) ([3f5f5b2](https://github.com/netflix/pollyjs/commit/3f5f5b2))\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/commit/a04d7a7))\n\n\n### Reverts\n\n* \"Update commitlint.config.js\" ([65e6996](https://github.com/netflix/pollyjs/commit/65e6996))\n* Add `json` property to `Request` ([4ea50e8](https://github.com/netflix/pollyjs/commit/4ea50e8))\n* Revert \"Update commitlint.config.js\" ([6624cb5](https://github.com/netflix/pollyjs/commit/6624cb5))\n* Revert Use docsify GA plugin ([35ace6f](https://github.com/netflix/pollyjs/commit/35ace6f))\n* Use docsify GA plugin ([cf5f1c5](https://github.com/netflix/pollyjs/commit/cf5f1c5))\n\n\n### BREAKING CHANGES\n\n* __Adapters__\n\n```js\nimport { XHRAdapter, FetchAdapter } from '@pollyjs/core';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\nadapters: ['xhr', FetchAdapter]\n});\n```\n\n__Persister__\n\n```js\nimport { LocalStoragePersister, RESTPersister } from '@pollyjs/core';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\npersister: 'local-storage'\n});\n\npolly.configure({\npersister: RESTPersister\n});\n```\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n* **core:** With this change, request ids will resolve to a different hash meaning that users will have to rerecord.\n* Relative URLs will have different hashes and will\nrequire to re-record.\n\n\n\n\n      # Changelog\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n\n## Getting Started\n\nInstall required global dependencies:\n\n```bash\nnpm install -g yarn\n```\n\nCheck out the code and go into the pollyjs directory:\n\n```bash\ngit clone https://github.com/netflix/pollyjs.git\ncd pollyjs\n```\n\nInstall the dependencies and bootstrap the monorepo:\n\n```bash\nyarn\n```\n\nThe code for individual packages of this monorepo are in `packages/@pollyjs/*`.\nWithin any of the packages in this monorepo you'll generally use the npm\npackage scripts to manage the project, E.g. `yarn run test` or\n`yarn run lint`. Run `yarn run` for a list of available commands.\n\n## Running Tests\n\n### Full Suite\n\nTo run the full test suite, from the root directory run:\n\n```bash\nyarn test\n```\n\nThis will perform a full bootstrap, clean and build on all of the sub-packages\nand test suite, stand up the node server, run the test suite and then terminate.\n\n### Running only changed tests\n\nWhile developing, it may become cumbersome to run the entire suite after each change.\nIn one terminal tab, run the following:\n\n```bash\nyarn watch\n```\n\nThis will build all of the sub-packages and test suite, watch for any changes, and\nperform incremental builds when the suite or packages are changed.\n\nWait until the build settles (i.e. build output stops scrolling). Then, in another tab:\n\n```bash\nyarn test:watch\n```\n\nThis will launch an interactive test runner (`testem`), which will automatically detect\nand re-run changed tests. To manually re-run the suite, hit `enter`. To exit, hit `q` and\nthen `ctrl-c` your watch process. For more information, look at the\n[testem docs](https://github.com/testem/testem).\n\n## Running Node Tests with Chrome Inspector\n\nTo run the node test suite with node inspector support, run from the root directory:\n\n```bash\nyarn test:ci -l Node:debug\n```\n\nNext, attach Chrome to the running process by visiting [chrome://inspect/#devices](chrome://inspect/#devices)\n\n## Running Docs\n\nAll the documentation can be found in the root level `docs` directory. Running\nthe following command will stand up the docs server which will watch for\nchanges.\n\n```bash\nyarn docs:serve\n```\n\n## Conventional Commits\n\nLerna depends on the use of the [Conventional Commits Specification](https://conventionalcommits.org/)\nto determine the version bump and generate CHANGELOG.md files. Make sure your\ncommits and the title of your PRs follow the spec. A pre-commit hook and CI test\nhave been added to further enforce this requirement.\n\n## Tips for Getting Your Pull Request Accepted\n\n1. Make sure all new features are tested and the tests pass.\n2. Bug fixes must include a test case demonstrating the error that it fixes.\n3. Open an issue first and seek advice for your change before submitting\n   a pull request. Large features which have never been discussed are\n   unlikely to be accepted. **You have been warned.**\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "OSSMETADATA",
    "content": "osslifecycle=active\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nPolly.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.\n\n> Interested in contributing or just seeing Polly in action? Head over to [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to spin up the project!\n\n## Why Polly?\n\nKeeping fixtures and factories in parity with your APIs can be a time consuming process.\nPolly alleviates this process by recording and maintaining actual server responses while also staying flexible.\n\n- Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.\n- Use Polly's client-side server to modify or intercept requests and responses to simulate different application states (e.g. loading, error, etc.).\n\n## Features\n\n- 🚀 Node & Browser Support\n- ⚡️️ Simple, Powerful, & Intuitive API\n- 💎 First Class Mocha & QUnit Test Helpers\n- 🔥 Intercept, Pass-Through, and Attach Events\n- 📼 Record to Disk or Local Storage\n- ⏱ Slow Down or Speed Up Time\n\n## Getting Started\n\nCheck out the [Quick Start](https://netflix.github.io/pollyjs/#/quick-start) documentation to get started.\n\n## Usage\n\nLet's take a look at what an example test case would look like using Polly.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\nimport RESTPersister from '@pollyjs/persister-rest';\n\n/*\n  Register the adapters and persisters we want to use. This way all future\n  polly instances can access them by name.\n*/\nPolly.register(XHRAdapter);\nPolly.register(FetchAdapter);\nPolly.register(RESTPersister);\n\ndescribe('Netflix Homepage', function () {\n  it('should be able to sign in', async function () {\n    /*\n      Create a new polly instance.\n\n      Connect Polly to both fetch and XHR browser APIs. By default, it will\n      record any requests that it hasn't yet seen while replaying ones it\n      has already recorded.\n    */\n    const polly = new Polly('Sign In', {\n      adapters: ['xhr', 'fetch'],\n      persister: 'rest'\n    });\n    const { server } = polly;\n\n    /* Intercept all Google Analytic requests and respond with a 200 */\n    server\n      .get('/google-analytics/*path')\n      .intercept((req, res) => res.sendStatus(200));\n\n    /* Pass-through all GET requests to /coverage */\n    server.get('/coverage').passthrough();\n\n    /* start: pseudo test code */\n    await visit('/login');\n    await fillIn('email', 'polly@netflix.com');\n    await fillIn('password', '@pollyjs');\n    await submit();\n    /* end: pseudo test code */\n\n    expect(location.pathname).to.equal('/browse');\n\n    /*\n      Calling `stop` will persist requests as well as disconnect from any\n      connected browser APIs (e.g. fetch or XHR).\n    */\n    await polly.stop();\n  });\n});\n```\n\nThe above test case would generate the following [HAR](http://www.softwareishard.com/blog/har-12-spec/)\nfile which Polly will use to replay the sign-in response when the test is rerun:\n\n```json\n{\n  \"log\": {\n    \"_recordingName\": \"Sign In\",\n    \"browser\": {\n      \"name\": \"Chrome\",\n      \"version\": \"67.0\"\n    },\n    \"creator\": {\n      \"name\": \"Polly.JS\",\n      \"version\": \"0.5.0\",\n      \"comment\": \"persister:rest\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"06f06e6d125cbb80896c41786f9a696a\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 51,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            }\n          ],\n          \"headersSize\": 97,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"POST\",\n          \"postData\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"text\": \"{\\\"email\\\":\\\"polly@netflix.com\\\",\\\"password\\\":\\\"@pollyjs\\\"}\"\n          },\n          \"queryString\": [],\n          \"url\": \"https://netflix.com/api/v1/login\"\n        },\n        \"response\": {\n          \"bodySize\": 0,\n          \"content\": {\n            \"mimeType\": \"text/plain; charset=utf-8\",\n            \"size\": 0\n          },\n          \"cookies\": [],\n          \"headers\": [],\n          \"headersSize\": 0,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-06-29T17:31:55.348Z\",\n        \"time\": 11,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 11\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n```\n\n## Prior Art\n\nThe \"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.\n\nThank 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).\n\n## Contributors\n\n[//]: contributor-faces\n\n<a href=\"https://github.com/offirgolan\"><img src=\"https://avatars.githubusercontent.com/u/575938?v=4\" title=\"offirgolan\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/jasonmit\"><img src=\"https://avatars.githubusercontent.com/u/3108309?v=4\" title=\"jasonmit\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/cibernox\"><img src=\"https://avatars.githubusercontent.com/u/265339?v=4\" title=\"cibernox\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/DenrizSusam\"><img src=\"https://avatars.githubusercontent.com/u/39295979?v=4\" title=\"DenrizSusam\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/dustinsoftware\"><img src=\"https://avatars.githubusercontent.com/u/942358?v=4\" title=\"dustinsoftware\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/silverchen\"><img src=\"https://avatars.githubusercontent.com/u/6683103?v=4\" title=\"silverchen\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/tombh\"><img src=\"https://avatars.githubusercontent.com/u/160835?v=4\" title=\"tombh\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/zkwentz\"><img src=\"https://avatars.githubusercontent.com/u/4832?v=4\" title=\"zkwentz\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/agraves\"><img src=\"https://avatars.githubusercontent.com/u/46964?v=4\" title=\"agraves\" width=\"80\" height=\"80\"></a>\n<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>\n<a href=\"https://github.com/swashcap\"><img src=\"https://avatars.githubusercontent.com/u/1858316?v=4\" title=\"swashcap\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/justsml\"><img src=\"https://avatars.githubusercontent.com/u/397632?v=4\" title=\"justsml\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/DanielRuf\"><img src=\"https://avatars.githubusercontent.com/u/827205?v=4\" title=\"DanielRuf\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/dciccale\"><img src=\"https://avatars.githubusercontent.com/u/539546?v=4\" title=\"dciccale\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/ericclemmons\"><img src=\"https://avatars.githubusercontent.com/u/15182?v=4\" title=\"ericclemmons\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/jamesgeorge007\"><img src=\"https://avatars.githubusercontent.com/u/25279263?v=4\" title=\"jamesgeorge007\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/woodenconsulting\"><img src=\"https://avatars.githubusercontent.com/u/4163029?v=4\" title=\"woodenconsulting\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/feinoujc\"><img src=\"https://avatars.githubusercontent.com/u/1733707?v=4\" title=\"feinoujc\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/josex2r\"><img src=\"https://avatars.githubusercontent.com/u/3719730?v=4\" title=\"josex2r\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/jomaxx\"><img src=\"https://avatars.githubusercontent.com/u/2747424?v=4\" title=\"jomaxx\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/karlhorky\"><img src=\"https://avatars.githubusercontent.com/u/1935696?v=4\" title=\"karlhorky\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/kennethlarsen\"><img src=\"https://avatars.githubusercontent.com/u/1408595?v=4\" title=\"kennethlarsen\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/poteto\"><img src=\"https://avatars.githubusercontent.com/u/1390709?v=4\" title=\"poteto\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/fastfrwrd\"><img src=\"https://avatars.githubusercontent.com/u/231133?v=4\" title=\"fastfrwrd\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/rwd\"><img src=\"https://avatars.githubusercontent.com/u/218337?v=4\" title=\"rwd\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/rmachielse\"><img src=\"https://avatars.githubusercontent.com/u/2470404?v=4\" title=\"rmachielse\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/ROpdebee\"><img src=\"https://avatars.githubusercontent.com/u/15186467?v=4\" title=\"ROpdebee\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/gribnoysup\"><img src=\"https://avatars.githubusercontent.com/u/5036933?v=4\" title=\"gribnoysup\" width=\"80\" height=\"80\"></a>\n<a href=\"https://github.com/shriyash\"><img src=\"https://avatars.githubusercontent.com/u/4494915?v=4\" title=\"shriyash\" width=\"80\" height=\"80\"></a>\n\n[//]: contributor-faces\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "docs/.nojekyll",
    "content": ""
  },
  {
    "path": "docs/_coverpage.md",
    "content": "<div class=\"netflix-logo\">\n  <div class=\"logo\"></div>\n</div>\n\n![logo](assets/images/wordmark-logo-alt.png)\n\n> Record, replay, and stub HTTP interactions.\n\n- 🚀 Node & Browser Support\n- ⚡️️ Simple, Powerful, & Intuitive API\n- 💎 First Class Mocha & QUnit Test Helpers\n- 🔥 Intercept, Pass-Through, and Attach Events\n- 📼 Record to Disk or Local Storage\n- ⏱ Slow Down or Speed Up Time\n\n<div class=\"buttons\">\n  <a href=\"https://github.com/Netflix/pollyjs/\" target=\"_blank\"><span>GitHub</span></a>\n  <a href=\"#/README\"><span>Get Started</span></a>\n</div>\n\n![color](#ffffff)\n"
  },
  {
    "path": "docs/_sidebar.md",
    "content": "- Getting Started\n\n  - [Overview](README.md)\n  - [Quick Start](quick-start.md)\n  - [Examples](examples.md)\n\n- Test Frameworks\n\n  - [Mocha](test-frameworks/mocha.md)\n  - [QUnit](test-frameworks/qunit.md)\n  - [Jest & Jasmine](test-frameworks/jest-jasmine.md)\n\n- Frameworks\n\n  - [Ember CLI](frameworks/ember-cli.md)\n\n- Adapters\n\n  - [Fetch](adapters/fetch.md)\n  - [Node HTTP](adapters/node-http.md)\n  - [Playwright](adapters/playwright.md)\n  - [Puppeteer](adapters/puppeteer.md)\n  - [XHR](adapters/xhr.md)\n  - [Custom](adapters/custom.md)\n\n- Persisters\n\n  - [File System](persisters/fs.md)\n  - [Local Storage](persisters/local-storage.md)\n  - [REST](persisters/rest.md)\n  - [Custom](persisters/custom.md)\n\n- Client Server\n\n  - [Overview](server/overview.md)\n  - [API](server/api.md)\n  - [Events & Middleware](server/events-and-middleware.md)\n  - [Route Handler](server/route-handler.md)\n  - [Request](server/request.md)\n  - [Response](server/response.md)\n  - [Event](server/event.md)\n\n- Node Server\n\n  - [Overview](node-server/overview.md)\n  - [Express Integrations](node-server/express-integrations.md)\n\n- CLI\n\n  - [Overview](cli/overview.md)\n  - [Commands](cli/commands.md)\n\n- Reference\n\n  - [API](api.md)\n  - [Configuration](configuration.md)\n\n- [Contributing](CONTRIBUTING.md)\n"
  },
  {
    "path": "docs/adapters/custom.md",
    "content": "# 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## Creating a Custom Adapter\n\nThe `@pollyjs/adapter` package provides an extendable base adapter class that\ncontains core logic dependent on by the [Fetch](adapters/fetch)\n& [XHR](adapters/xhr) adapters.\n\n### Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter -D\n```\n\n### Usage\n\n```js\nimport Adapter from '@pollyjs/adapter';\n\nclass CustomAdapter extends Adapter {\n  static get id() {\n    return 'custom';\n  }\n\n  onConnect() {\n    /* Do something when the adapter is connect to */\n  }\n\n  onDisconnect() {\n    /* Do something when the adapter is disconnected from */\n  }\n\n  async onFetchResponse(pollyRequest) {\n    /* Do something when the adapter is connect to */\n  }\n\n  /* optional */\n  async onRespond(pollyRequest) {\n    const { statusCode, body, headers } = pollyRequest.response;\n    /* Deliver the response to the user */\n  }\n}\n```\n\nThe `Adapter` class provides the `handleRequest()` method which can be\ncalled from `onConnect`. It accepts request parameters and returns a\nPollyRequest object with a `response` property.\n\nThe `onFetchResponse` method takes a PollyRequest object, makes a real HTTP\nrequest and returns the response as a `{ statusCode, headers, body }` object,\nwhere `body` is a string.\n\nThe `onRespond()` method makes sure that the response has been delivered\nto the user. `pollyjs.flush()` will wait for all `onResponds()` calls to\nfinish. You can omit the implementation of this method if no asynchronous\ndelivery is required.\n\n### Simple Fetch adapter example\n\nThe following is a simple example of implementing an adapter for `fetch`. For\nfull examples, please refer to the source code for the\n[Fetch](https://github.com/Netflix/pollyjs/blob/master/packages/@pollyjs/adapter-fetch/src/index.js)\n& [XHR](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/adapter-xhr/src/index.js)\nadapters.\n\n```js\nclass FetchAdapter extends Adapter {\n  static get id() {\n    return 'fetch';\n  }\n\n  onConnect() {\n    this.originalFetch = window.fetch;\n\n    window.fetch = async (url, options = {}) => {\n      const { response } = await this.handleRequest({\n        url,\n        method: options.method,\n        headers: options.headers,\n        body: options.body\n      });\n\n      return new Response(response.body, {\n        status: response.statusCode,\n        statusText: response.statusText,\n        headers: response.headers\n      });\n    };\n  }\n\n  onDisconnect() {\n    window.fetch = this.originalFetch;\n  }\n\n  async onFetchResponse(pollyRequest) {\n    const response = await this.originalFetch([\n      pollyRequest.url,\n      {\n        method: pollyRequest.method,\n        headers: pollyRequest.headers,\n        body: pollyRequest.body\n      }\n    ]);\n\n    return {\n      statusCode: response.status,\n      headers: serializeHeaders(response.headers),\n      body: await response.text()\n    };\n  }\n}\n```\n\n## Extending from an Existing Adapter\n\nThe `@pollyjs/core` package exports the `XHRAdapter` and `FetchAdapter` classes,\nallowing you to modify them as needed.\n\n```js\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\n\nclass CustomXHRAdapter extends XHRAdapter {}\nclass CustomFetchAdapter extends FetchAdapter {}\n```\n\n## Registering & Connecting to a Custom Adapter\n\nYou can register and connect to a custom adapter by passing an array to the `adapters`\nconfig where the first element is the name of your adapter and the second is the\nadapter class.\n\n```js\n// Register and connect to a custom adapter:\nnew Polly('Custom Adapter', {\n  adapters: [MyCustomAdapterClass]\n});\n\n// Register and connect to a custom adapter via .configure():\nconst polly = new Polly('Custom Adapter');\n\npolly.configure({\n  adapters: [MyCustomAdapterClass]\n});\n```\n"
  },
  {
    "path": "docs/adapters/fetch.md",
    "content": "# Fetch Adapter\n\nThe fetch adapter wraps the global fetch method for seamless\nrecording and replaying of requests.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-fetch -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-fetch -D\n```\n\n## Usage\n\nUse the [configure](api#configure), [connectTo](api#connectto), and\n[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the\nadapter.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\n\n// Register the fetch adapter so its accessible by all future polly instances\nPolly.register(FetchAdapter);\n\nconst polly = new Polly('<Recording Name>', {\n  adapters: ['fetch']\n});\n\n// Disconnect using the `configure` API\npolly.configure({ adapters: [] });\n\n// Reconnect using the `connectTo` API\npolly.connectTo('fetch');\n\n// Disconnect using the `disconnectFrom` API\npolly.disconnectFrom('fetch');\n```\n\n## Options\n\n### context\n\n_Type_: `Object`\n_Default_: `global|self|window`\n\nThe context object which contains the fetch API. Typically this is `window` or `self` in the browser and `global` in node.\n\n**Example**\n\n```js\npolly.configure({\n  adapters: ['fetch'],\n  adapterOptions: {\n    fetch: {\n      context: window\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/adapters/node-http.md",
    "content": "# Node HTTP Adapter\n\nThe 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.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-node-http -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-node-http -D\n```\n\n## Usage\n\nUse the [configure](api#configure), [connectTo](api#connectto), and\n[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the\nadapter.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport NodeHttpAdapter from '@pollyjs/adapter-node-http';\n\n// Register the node http adapter so its accessible by all future polly instances\nPolly.register(NodeHttpAdapter);\n\nconst polly = new Polly('<Recording Name>', {\n  adapters: ['node-http']\n});\n\n// Disconnect using the `configure` API\npolly.configure({ adapters: [] });\n\n// Reconnect using the `connectTo` API\npolly.connectTo('node-http');\n\n// Disconnect using the `disconnectFrom` API\npolly.disconnectFrom('node-http');\n```\n"
  },
  {
    "path": "docs/adapters/playwright.md",
    "content": "# Playwright Adapter\n\nThe 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.\n\n[README.md](https://raw.githubusercontent.com/redabacha/polly-adapter-playwright/master/README.md ':include :type=markdown')\n"
  },
  {
    "path": "docs/adapters/puppeteer.md",
    "content": "# Puppeteer Adapter\n\nThe [Puppeteer](https://pptr.dev/) adapter attaches events to a given\n[page](https://pptr.dev/#?product=Puppeteer&show=api-class-page) instance allowing\nyou to get the full power of Polly and Puppeteer.\n\n## Installation\n\n?> **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.\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-puppeteer -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-puppeteer -D\n```\n\n## Usage\n\nUse the [configure](api#configure), [connectTo](api#connectto), and\n[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the\nadapter.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport PuppeteerAdapter from '@pollyjs/adapter-puppeteer';\n\n// Register the puppeteer adapter so its accessible by all future polly instances\nPolly.register(PuppeteerAdapter);\n\nconst browser = await puppeteer.launch();\nconst page = await this.browser.newPage();\n\nawait page.setRequestInterception(true);\n\nconst polly = new Polly('<Recording Name>', {\n  adapters: ['puppeteer'],\n  adapterOptions: {\n    puppeteer: { page }\n  }\n});\n\n// Disconnect using the `configure` API\npolly.configure({ adapters: [] });\n\n// Reconnect using the `connectTo` API\npolly.connectTo('puppeteer');\n\n// Disconnect using the `disconnectFrom` API\npolly.disconnectFrom('puppeteer');\n```\n\n## Options\n\n### page\n\n_Type_: [Page](https://pptr.dev/#?product=Puppeteer&show=api-class-page)\n_Default_: `null`\n\n!> **NOTE:** This is a _required_ option.\n\nThe Puppeteer page instance Polly should attach events to in order to intercept\nrequests.\n\n**Example**\n\n```js\nconst browser = await puppeteer.launch();\nconst page = await this.browser.newPage();\n\nawait page.setRequestInterception(true);\n\npolly.configure({\n  adapters: ['puppeteer'],\n  adapterOptions: {\n    puppeteer: { page }\n  }\n});\n\nawait page.goto('http://netflix.com');\n```\n\n### requestResourceTypes\n\n_Type_: `Array`\n_Default_: `['xhr', 'fetch']`\n\nThe request [resource types](https://pptr.dev/#?product=Puppeteer&show=api-requestresourcetype)\nto intercept.\n\n**Example**\n\n```js\npolly.configure({\n  adapterOptions: {\n    puppeteer {\n      requestResourceTypes: ['xhr']\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/adapters/xhr.md",
    "content": "# XHR Adapter\n\nThe XHR adapter uses Sinon's [Nise](https://github.com/sinonjs/nise) library\nto fake the global `XMLHttpRequest` object while wrapping the native one to allow\nfor seamless recording and replaying of requests.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-xhr -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-xhr -D\n```\n\n## Usage\n\nUse the [configure](api#configure), [connectTo](api#connectto), and\n[disconnectFrom](api#disconnectfrom) APIs to connect or disconnect from the\nadapter.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\nconst polly = new Polly('<Recording Name>', {\n  adapters: ['xhr']\n});\n\n// Disconnect using the `configure` API\npolly.configure({ adapters: [] });\n\n// Reconnect using the `connectTo` API\npolly.connectTo('xhr');\n\n// Disconnect using the `disconnectFrom` API\npolly.disconnectFrom('xhr');\n```\n\n## Options\n\n### context\n\n_Type_: `Object`\n_Default_: `global|self|window`\n\nThe context object which contains the XMLHttpRequest object. Typically this is `window` or `self` in the browser and `global` in node.\n\n**Example**\n\n```js\npolly.configure({\n  adapters: ['xhr'],\n  adapterOptions: {\n    xhr: {\n      context: window\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/api.md",
    "content": "# API\n\n## Constructor\n\nCreate a new Polly instance.\n\n| Param         | Type     | Description                                                               |\n| ------------- | -------- | ------------------------------------------------------------------------- |\n| recordingName | `String` | Name of the [recording](api#recordingName) to store the recordings under. |\n| config        | `Object` | [Configuration](configuration) object                                     |\n| **Returns**   | `Polly`  | &nbsp;                                                                    |\n\n**Example**\n\n```js\nnew Polly('<Recording Name>', {\n  /* ... */\n});\n```\n\n## Events\n\n### create\n\nEmitted when a Polly instance gets created.\n\n!> This is a synchronous event.\n\n**Example**\n\n```js\nconst listener = polly => {\n  /* Do Something */\n};\n\nPolly.on('create', listener);\nPolly.off('create', listener);\nPolly.once('create', polly => {\n  /* Do Something Once */\n});\n```\n\n### stop\n\nEmitted when a Polly instance has successfully stopped.\n\n**Example**\n\n```js\nconst listener = polly => {\n  /* Do Something */\n};\n\nPolly.on('stop', listener);\nPolly.off('stop', listener);\nPolly.once('stop', polly => {\n  /* Do Something Once */\n});\n```\n\n## Properties\n\n### recordingName\n\n_Type_: `String`\n_Default_: `null`\n\nThe recording name the recordings will be stored under. The provided name is\nsanitized as well as postfixed with a GUID.\n\n**Example**\n\n```js\nnew Polly('Wants a Cracker', {\n  /* ... */\n});\n```\n\nWill save recordings to the following file:\n\n```text\nrecordings\n  └── Wants-a-Cracker_1234\n      └── recording.json\n```\n\n**Example**\n\n?> A recording can also have slashes to better organize recordings.\n\n```js\nnew Polly('Wants a Cracker/Cheddar');\n```\n\nWill save recordings to the following file:\n\n```text\nrecordings\n  └── Wants-a-Cracker_1234\n      └── Cheddar_5678\n          └── recording.json\n```\n\n### mode\n\n_Type_: `String`\n_Default_: `'replay'`\n\nThe current [mode](configuration#mode) polly is in.\n\n**Example**\n\n```js\nconst polly = new Polly();\n\npolly.mode; // → 'replay'\npolly.record();\npolly.mode; // → 'record'\n```\n\n### persister\n\n_Type_: `Persister`\n_Default_: `null`\n\nThe persister used to find and save recordings.\n\n### server\n\n_Type_: `Server`\n_Default_: `Server`\n\nEvery polly instance has a reference to a [client-side server](server/overview) which you can leverage\nto gain full control of all HTTP interactions as well as dictate how the Polly instance\nshould handle them.\n\n```js\nconst { server } = polly;\n\nserver.get('/movies').passthrough();\nserver.get('/series').intercept((req, res) => res.sendStatus(200));\n```\n\n## Methods\n\n### configure\n\nConfigure polly with the given configuration object.\n\n| Param  | Type     | Description                           |\n| ------ | -------- | ------------------------------------- |\n| config | `Object` | [Configuration](configuration) object |\n\n**Example**\n\n```js\npolly.configure({ recordIfMissing: false });\n```\n\n### record\n\nPuts polly in recording mode. All requests going forward will\nbe sent to the server and their responses will be recorded.\n\n**Example**\n\n```js\npolly.record();\n```\n\n### replay\n\nPuts polly in replay mode. All requests going forward will be\nplayed back from a saved recording.\n\n**Example**\n\n```js\npolly.replay();\n```\n\n### passthrough\n\nPuts polly in pass-through mode. All requests going forward will pass-through\ndirectly to the server without being recorded or replayed.\n\n**Example**\n\n```js\npolly.passthrough();\n```\n\n### pause\n\nDisconnects the polly instance from all connected adapters. This ensures that\nno requests will be handled by the polly instance until calling [play](api#play)\nor manually connecting to a new adapter via [connectTo](api#connectTo). The\npreviously connected adapters will be saved and can be restored by\ncalling [play](api#play).\n\n?> If using the [Puppeteer Adapter](adapters/puppeteer), you'll need to also\ndisable request interception via `await page.setRequestInterception(false)`.\n\n**Example**\n\n```js\nawait fetch('/api/not-a-secret');\npolly.pause();\n// This and all subsequent requests will no longer be handled by polly\nawait fetch('/api/secret');\n```\n\n### play\n\nReconnects to the adapters that were disconnected when [pause](api#pause)\nwas called.\n\n?> If using the [Puppeteer Adapter](adapters/puppeteer), you'll need to also\nenable request interception via `await page.setRequestInterception(true)`.\n\n**Example**\n\n```js\nawait fetch('/api/not-a-secret');\npolly.pause();\n// This and all subsequent requests will no longer be handled by polly\nawait fetch('/api/secret');\npolly.play();\n// This and all subsequent requests will again be handled by polly\nawait fetch('/api/not-a-secret');\n```\n\n### stop\n\nPersist all recordings and disconnect from all adapters.\n\n!> This method is `async` and will resolve once all recordings have\npersisted and the instance has successfully torn down.\n\n| Param   | Type      | Description |\n| ------- | --------- | ----------- |\n| Returns | `Promise` | &nbsp;      |\n\n**Example**\n\n```js\nawait polly.stop();\n```\n\n### connectTo\n\nConnect to an adapter.\n\n| Param | Type              | Description                             |\n| ----- | ----------------- | --------------------------------------- |\n| name  | `String|Function` | The adapter name of class to connect to |\n\n**Example**\n\n```js\npolly.connectTo('xhr');\npolly.connectTo(XHRAdapter);\n```\n\n### disconnectFrom\n\nDisconnect from an adapter.\n\n| Param | Type              | Description                                  |\n| ----- | ----------------- | -------------------------------------------- |\n| name  | `String|Function` | The adapter name of class to disconnect from |\n\n**Example**\n\n```js\npolly.disconnectFrom('xhr');\npolly.disconnectFrom(XHRAdapter);\n```\n\n### disconnect\n\nDisconnect from all connected adapters.\n\n**Example**\n\n```js\npolly.disconnect();\n```\n\n### flush\n\nReturns a Promise that resolves once all requests handled by Polly have resolved.\n\n| Param   | Type      | Description |\n| ------- | --------- | ----------- |\n| Returns | `Promise` | &nbsp;      |\n\n**Example**\n\n```js\nawait polly.flush();\n```\n"
  },
  {
    "path": "docs/assets/styles.css",
    "content": ":root {\n  --theme-color: #e50914;\n  --theme-color-dark: #b20710;\n\n  --text-color-base: #2e2e46;\n  --text-color-secondary: #646473;\n  --text-color-tertiary: #81818e;\n}\n\nbody {\n  font-size: 100%;\n  line-height: 1.5;\n  color: var(--text-color-base);\n}\n\n* {\n  text-decoration: none !important;\n}\n\na {\n  transition: all 0.3s linear;\n}\n\n.github-corner {\n  z-index: 5;\n}\n\n/****** Cover Page ******/\nsection.cover {\n  padding-bottom: 112px; /* fixed footer (Netflix) height */\n  height: auto;\n  min-height: 100vh;\n  /**\n   * Intended to defeat this inline style on initial boot that flashes when on page load:\n   * https://github.com/docsifyjs/docsify/blob/8352a1e489abc2a7b6361fe02d696e1891a031cd/src/core/render/tpl.js#L56-L70\n   */\n  background: #fff !important;\n}\n\nsection.cover .cover-main {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  flex-direction: column;\n  margin: 0;\n  padding: 32px 16px 0;\n}\n\nsection.cover img {\n  width: 400px;\n}\n\nsection.cover h1 {\n  margin: 0.625rem 0 1rem;\n}\n\nsection.cover blockquote,\nsection.cover blockquote p {\n  margin: 0;\n}\n\nsection.cover ul {\n  font-size: 1.25rem;\n  line-height: 2rem;\n  display: grid;\n  text-align: left;\n  grid-column-gap: 16px;\n  grid-row-gap: 20px;\n  grid-template-columns: repeat(2, 50%);\n  list-style: none;\n  max-width: unset;\n  margin: 1.5em 0;\n}\n\nsection.cover ul li {\n  white-space: nowrap;\n}\n\nsection.cover.show ~ .sidebar,\nsection.cover.show ~ .sidebar-toggle {\n  display: none;\n}\n\n.cover-main .netflix-logo {\n  position: fixed;\n  display: flex;\n  align-items: center;\n  background: #ffffff;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  padding: 40px;\n  z-index: 5;\n}\n\n.cover-main .netflix-logo .logo {\n  width: 125px;\n  height: 32px;\n  background: url('images/Netflix_Logo.png');\n  background-size: 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n.cover-main .buttons {\n  width: 100%;\n}\n\n.cover-main .buttons a {\n  font-weight: 700;\n  position: relative;\n  display: inline-block;\n  padding: 12px 25px;\n  font-size: 14px;\n  text-align: center;\n  line-height: 18px;\n  color: #221f1f;\n  background: #fff;\n  outline: none;\n  border: none;\n  background-color: #fff;\n  -webkit-appearance: none;\n  -moz-appearance: none;\n  cursor: pointer;\n  margin: 0 1rem;\n  color: var(--theme-color);\n  overflow: hidden;\n  transition: color 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);\n  vertical-align: baseline;\n  text-transform: uppercase;\n}\n\n.cover-main .buttons a:before,\n.cover-main .buttons a:after {\n  content: '';\n  display: block;\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  top: 0;\n  left: 0;\n  border: 2px solid var(--theme-color);\n  box-sizing: border-box;\n}\n\n.cover-main .buttons a:after {\n  background: var(--theme-color);\n  transform: translateX(-101%);\n  transition: all 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);\n}\n\n.cover-main .buttons a:hover {\n  color: white;\n  box-shadow: 0 5px 16px rgba(229, 9, 20, 0.3);\n}\n\n.cover-main .buttons a:hover:after {\n  transform: translateX(0);\n}\n\n.cover-main .buttons a span {\n  position: relative;\n  z-index: 1;\n}\n\n@media (max-width: 850px) {\n  section.cover ul {\n    grid-template-columns: 100%;\n    padding: 0;\n  }\n\n  section.cover ul li {\n    text-align: center;\n  }\n}\n\n@media (max-width: 450px) {\n  section.cover ul li {\n    white-space: normal;\n  }\n\n  .cover-main .buttons a {\n    width: 100%;\n    margin: 0.2rem 0;\n  }\n}\n\n/****** Sidebar ******/\n.sidebar .app-name-link img {\n  height: 150px;\n}\n\n.sidebar ul li a {\n  font-size: 15px;\n}\n\n.sidebar ul li a:hover {\n  color: var(--theme-color);\n}\n\n.app-sub-sidebar li:before {\n  display: none;\n}\n\n.sidebar .search .clear-button {\n  cursor: pointer;\n}\n\n/****** Sidebar Toggle ******/\n.sidebar-toggle {\n  cursor: pointer;\n}\n\nbody .sidebar-toggle {\n  background: none;\n  top: 1.5rem;\n  left: calc(300px + 1.5rem);\n  cursor: pointer;\n  width: 1.5rem;\n  height: 1.5rem;\n  padding: 0;\n  transition: left 0.25s ease-out;\n}\n\nbody .sidebar-toggle span {\n  background-color: var(--theme-color);\n  height: 0.2rem;\n  width: 1.5rem;\n  position: absolute;\n  left: 0;\n  margin: 0;\n  transform-origin: 0;\n  border-radius: 1px;\n}\n\nbody.close .sidebar-toggle {\n  transition: left 0.25s ease-out;\n  width: 1.5rem;\n  height: 1.5rem;\n  left: 1.5rem;\n}\n\nbody.close .sidebar-toggle span {\n  transform-origin: center;\n}\n\nbody .sidebar-toggle span:nth-child(1) {\n  top: 0;\n}\nbody .sidebar-toggle span:nth-child(2) {\n  top: 0.5rem;\n}\nbody .sidebar-toggle span:nth-child(3) {\n  top: 1rem;\n}\n\n.sidebar-toggle:hover {\n  opacity: 0.8;\n}\n.sidebar-toggle .sidebar-toggle-button:hover {\n  opacity: 1;\n}\n\n@media screen and (max-width: 768px) {\n  body .sidebar-toggle {\n    left: 1rem;\n  }\n\n  body.close .sidebar-toggle {\n    left: calc(300px + 1.5rem);\n  }\n}\n\n/****** Markdown General ******/\n.markdown-section {\n  padding: 30px 30px 40px;\n}\n\n.markdown-section a {\n  text-decoration: none;\n  border-bottom: 0.1rem solid var(--theme-color);\n  transition: all 0.3s ease;\n}\n\n.markdown-section a:hover {\n  border-color: var(--theme-color-dark);\n  color: var(--theme-color-dark);\n}\n\n.markdown-section a.anchor {\n  border: none;\n}\n\n/****** Markdown Table ******/\n.markdown-section table {\n  display: table;\n}\n\n.markdown-section table tr {\n  border-width: 0.15rem 0;\n  border-style: solid;\n  border-color: #f1f1f2;\n}\n\n.markdown-section table thead tr {\n  text-transform: uppercase;\n  font-size: 90%;\n  border-top: none;\n}\n\n.markdown-section table tbody tr:last-of-type {\n  border-bottom: none;\n}\n\n.markdown-section table tr:nth-child(2n) {\n  background-color: transparent;\n}\n\n.markdown-section table td,\n.markdown-section table th {\n  border: none;\n  padding: 1.1rem 0.5rem;\n  text-align: left;\n}\n\n.markdown-section table td p {\n  margin: 0;\n}\n\n.markdown-section blockquote {\n  margin: 1em 0;\n}\n\n.markdown-section blockquote > p {\n  font-weight: 500;\n}\n\n.markdown-section em,\n.markdown-section blockquote {\n  color: var(--text-color-tertiary);\n}\n\n/****** CODE HIGHLIGHTING ******/\n.token.string {\n  color: #42b983;\n}\n\n.token.boolean,\n.token.number {\n  color: var(--theme-color);\n}\n\n.lang-bash .token.function,\n.lang-json .token.property {\n  color: #e96900;\n}\n\n/****** COPY TO CLIPBOARD ******/\n.docsify-copy-code-button {\n  font-size: 0.7em !important;\n}\n"
  },
  {
    "path": "docs/cli/commands.md",
    "content": "# 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\nStart up a node server and listen for Polly requests via the\n[REST Persister](persisters/rest) to be able to record and replay recordings\nto and from disk.\n\n### Usage\n\n```text\n  Usage: polly listen|l [options]\n\n  start the server and listen for requests\n\n  Options:\n\n    -H, --host <host>                host\n    -p, --port <port>                port number (default: 3000)\n    -n, --api-namespace <namespace>  api namespace (default: polly)\n    -d, --recordings-dir <path>      recordings directory (default: recordings)\n    -q, --quiet                      disable the logging\n    -h, --help                       output usage information\n```\n"
  },
  {
    "path": "docs/cli/overview.md",
    "content": "# Overview\n\nThe `@pollyjs/cli` package provides a standalone CLI to quickly get you setup\nand ready to go.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/cli -g\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn global add @pollyjs/cli\n```\n\n## Usage\n\n```text\n  Usage: polly [options] [command]\n\n  Options:\n\n    -v, --version       output the version number\n    -h, --help          output usage information\n\n  Commands:\n\n    listen|l [options]  start the server and listen for requests\n```\n"
  },
  {
    "path": "docs/configuration.md",
    "content": "# Configuration\n\nA Polly instance can be configured by passing a configuration object\nto the constructor's 2nd argument:\n\n```js\nnew Polly('<Recording Name>', {\n  recordIfMissing: false\n});\n```\n\nOr via the [configure](api#configure) method on the instance:\n\n```js\nconst polly = new Polly('<Recording Name>');\n\npolly.configure({\n  recordIfMissing: false\n});\n```\n\n## Defaults\n\n[config.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/packages/@pollyjs/core/src/defaults/config.js ':include :type=code')\n\n## logLevel\n\n_Type_: `'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'`\n_Default_: `'warn'`\n\nSet the log level for the polly instance.\n\n**Example**\n\n```js\npolly.configure({\n  logLevel: 'info'\n});\n```\n\n## recordIfMissing\n\n_Type_: `Boolean`\n_Default_: `true`\n\nIf a request's recording is not found, pass-through to the server and\nrecord the response.\n\n**Example**\n\n```js\npolly.configure({\n  recordIfMissing: true\n});\n```\n\n## recordFailedRequests\n\n_Type_: `Boolean`\n_Default_: `false`\n\nIf `false`, Polly will throw when attempting to persist any failed requests.\nA request is considered to be a failed request when its response's status code\nis `≥ 400`.\n\n**Example**\n\n```js\npolly.configure({\n  recordFailedRequests: true\n});\n```\n\n## flushRequestsOnStop\n\n_Type_: `Boolean`\n_Default_: `false`\n\nAwait any unresolved requests handled by the polly instance\n(via [flush](api#flush)) when [stop](api#stop) is called.\n\n**Example**\n\n```js\npolly.configure({\n  flushRequestsOnStop: true\n});\n```\n\n## expiresIn\n\n_Type_: `String`\n_Default_: `null`\n\nAfter how long the recorded request will be considered expired from the time\nit was persisted. A recorded request is considered expired if the recording's\n`startedDateTime` plus the current `expiresIn` duration is in the past.\n\n**Example**\n\n```js\npolly.configure({\n  expiresIn: '30d5h10m' // expires in 30 days, 5 hours, and 10 minutes\n});\n\npolly.configure({\n  expiresIn: '5 min 10 seconds 100 milliseconds' // expires in 5 minutes, 10 seconds, and 100 milliseconds\n});\n```\n\n## expiryStrategy\n\n_Type_: `'warn' | 'error' | 'record'`\n_Default_: `'warn'`\n\nThe strategy for what should occur when Polly tries to use an expired recording in `replay` mode. Can be one of the following:\n\n- `warn`: Log a console warning about the expired recording.\n- `error`: Throw an error.\n- `record`: Re-record by making a new network request.\n\n**Example**\n\n```js\npolly.configure({\n  expiryStrategy: 'error'\n});\n```\n\n## mode\n\n_Type_: `String`\n_Default_: `'replay'`\n\nThe Polly mode. Can be one of the following:\n\n- `replay`: Replay responses from recordings.\n- `record`: Force Polly to record all requests. This will overwrite recordings that already exist.\n- `passthrough`: Passes all requests through directly to the server without recording or replaying.\n\n**Example**\n\n```js\npolly.configure({\n  mode: 'record'\n});\n```\n\n## adapters\n\n_Type_: `Array[String|Function]`\n_Default_: `[]`\n\nThe adapter(s) polly will hook into.\n\n**Example**\n\n```js\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\n  adapters: ['xhr', FetchAdapter]\n});\n```\n\n## adapterOptions\n\n_Type_: `Object`\n_Default_: `{}`\n\nOptions to be passed into the adapters keyed by the adapter name.\n\n?> **NOTE:** Check out the appropriate documentation pages for each adapter\nfor more details.\n\n**Example**\n\n```js\npolly.configure({\n  adapterOptions: {\n    fetch: {\n      context: win\n    }\n  }\n});\n```\n\n## persister\n\n_Type_: `String|Function`\n_Default_: `null`\n\nThe persister to use for recording and replaying requests.\n\n**Example**\n\n```js\nimport RESTPersister from '@pollyjs/persister-rest';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\n  persister: 'local-storage'\n});\n\npolly.configure({\n  persister: RESTPersister\n});\n```\n\n## persisterOptions\n\n_Type_: `Object`\n_Default_: `{}`\n\nOptions to be passed into the persister keyed by the persister name.\n\n?> **NOTE:** Check out the appropriate documentation pages for each persister\nfor more details.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    rest: {\n      apiNamespace: '/polly'\n    }\n  }\n});\n```\n\n### keepUnusedRequests\n\n_Type_: `Boolean`\n_Default_: `false`\n\nWhen disabled, requests that have not been captured by the running Polly\ninstance will be removed from any previous recording. This ensures that a\nrecording will only contain the requests that were made during the lifespan\nof the Polly instance. When enabled, new requests will be appended to the\nrecording file.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    keepUnusedRequests: true\n  }\n});\n```\n\n### disableSortingHarEntries\n\n_Type_: `Boolean`\n_Default_: `false`\n\nWhen disabled, entries in the the final HAR will be sorted by the request's timestamp.\nThis is done by default to satisfy the HAR 1.2 spec but can be enabled to improve\ndiff readability when committing recordings to git.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    disableSortingHarEntries: true\n  }\n});\n```\n\n## timing\n\n_Type_: `Function`\n_Default_: `Timing.fixed(0)`\n\nThe timeout delay strategy used when replaying requests.\n\n**Example**\n\n```js\nimport { Timing } from '@pollyjs/core';\n\npolly.configure({\n  // Replay requests at 300% the original speed to simulate a 3g connection\n  timing: Timing.relative(3.0)\n});\n\npolly.configure({\n  // Replay requests with a 200ms delay\n  timing: Timing.fixed(200)\n});\n```\n\n## matchRequestsBy\n\n_Type_: `Object`\n\n_Default_:\n\n```js\nmatchRequestsBy: {\n  method: true,\n  headers: true,\n  body: true,\n  order: true,\n\n  url: {\n    protocol: true,\n    username: true,\n    password: true,\n    hostname: true,\n    port: true,\n    pathname: true,\n    query: true,\n    hash: false\n  }\n}\n```\n\nRequest matching configuration. Each of these options are used to generate\na GUID for the request.\n\n- ### method\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  The request method (e.g. `GET`, `POST`)\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      method: false\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      method(method, req) {\n        return method.toLowerCase();\n      }\n    }\n  });\n  ```\n\n- ### headers\n\n  _Type_: `Boolean | Function | Object`\n  _Default_: `true`\n\n  The request headers.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      headers: false\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      headers(headers, req) {\n        delete headers['X-AUTH-TOKEN'];\n        return headers;\n      }\n    }\n  });\n  ```\n\n  Specific headers can also be excluded with the following:\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      headers: {\n        exclude: ['X-AUTH-TOKEN']\n      }\n    }\n  });\n  ```\n\n- ### body\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  The request body.\n\n  !> 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.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      body: false\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      body(body, req) {\n        const json = JSON.parse(body);\n\n        delete json.email;\n        return JSON.stringify(json);\n      }\n    }\n  });\n  ```\n\n- ### order\n\n  _Type_: `Boolean`\n  _Default_: `true`\n\n  The order the request came in. Take the following scenario:\n\n  ```js\n  // Retrieve our model\n  let model = await fetch('/models/1').then((res) => res.json());\n\n  // Modify the model\n  model.foo = 'bar';\n\n  // Save the model with our new change\n  await fetch('/models/1', { method: 'POST', body: JSON.stringify(model) });\n\n  // Get our updated model\n  model = await fetch('/models/1').then((res) => res.json());\n\n  // Assert that our change persisted\n  expect(model.foo).to.equal('bar');\n  ```\n\n  The order of the requests matter since the payload for the first and\n  last fetch are different.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      order: false\n    }\n  });\n  ```\n\n- ### url\n\n  _Type_: `Boolean | Function | Object`\n  _Default_: `{ protocol: true, username: true, ... }`\n\n  The request url.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: false\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url(url, req) {\n        return url.replace('test', '');\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        protocol(protocol) {\n          return 'https:';\n        },\n        query: false\n      }\n    }\n  });\n  ```\n\n- ### url.protocol\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  The request url protocol (e.g. `http:`).\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        protocol: false\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        protocol(protocol, req) {\n          return 'https:';\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.username\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  Username of basic authentication.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        username: false\n      }\n    }\n  });\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        username(username, req) {\n          return 'username';\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.password\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  Password of basic authentication.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        password: false\n      }\n    }\n    matchRequestsBy: {\n      url: {\n        password(password, req) {\n          return 'password';\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.hostname\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  Host name without port number.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        hostname: false\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        hostname(hostname, req) {\n          return hostname.replace('.com', '.net');\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.port\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  Port number.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        port: false\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        port(port, req) {\n          return 3000;\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.pathname\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  URL path.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        pathname(pathname, req) {\n          return pathname.replace('/api/v1', '/api');\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.query\n\n  _Type_: `Boolean | Function`\n  _Default_: `true`\n\n  Sorted query string.\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        query: false\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        query(query, req) {\n          return { ...query, token: '' };\n        }\n      }\n    }\n  });\n  ```\n\n- ### url.hash\n\n  _Type_: `Boolean | Function`\n  _Default_: `false`\n\n  The \"fragment\" portion of the URL including the pound-sign (`#`).\n\n  **Example**\n\n  ```js\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        hash: true\n      }\n    }\n  });\n\n  polly.configure({\n    matchRequestsBy: {\n      url: {\n        hash(hash, req) {\n          return hash.replace(/token=[0-9]+/, '');\n        }\n      }\n    }\n  });\n  ```\n"
  },
  {
    "path": "docs/examples.md",
    "content": "# Examples\n\n## Client Server\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/client-server)**\n\n[intercept.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/client-server/tests/intercept.test.js ':include :type=code')\n\n[events.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/client-server/tests/events.test.js ':include :type=code')\n\n## REST Persister\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/rest-persister)**\n\n[package.json](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/rest-persister/package.json ':include :type=code')\n\n[rest-persister.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/rest-persister/tests/rest-persister.test.js ':include :type=code')\n\n## Node Fetch\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/node-fetch)**\n\n[node-fetch.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/node-fetch/tests/node-fetch.test.js ':include :type=code')\n\n## Puppeteer\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/puppeteer)**\n\n[index.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/puppeteer/index.js ':include :type=code')\n\n## Jest + Node Fetch\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/jest-node-fetch)**\n\n[index.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/jest-node-fetch/__tests__/index.test.js ':include :type=code')\n\n## TypeScript + Jest + Node Fetch\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/typescript-jest-node-fetch)**\n\n[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')\n\n[github-api.test.ts](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/typescript-jest-node-fetch/src/github-api.test.ts ':include :type=code')\n\n## Jest + Puppeteer\n\n**[Full Source](https://github.com/Netflix/pollyjs/tree/master/examples/jest-puppeteer)**\n\n[dummy-app.test.js](https://raw.githubusercontent.com/Netflix/pollyjs/master/examples/jest-puppeteer/__tests__/dummy-app.test.js ':include :type=code')\n"
  },
  {
    "path": "docs/frameworks/ember-cli.md",
    "content": "# Ember CLI\n\nInstalling the `@pollyjs/ember` addon will import and vendor the necessary\nPolly.JS packages as well as register the [Express API](node-server/express-integrations)\nrequired by the [REST Persister](persisters/rest).\n\n?> **NOTE:** By default, this addon installs and registers the\n[XHR](adapters/xhr) & [Fetch](adapters/fetch) adapters as well as the\n[REST](persisters/rest) & [Local Storage](persisters/local-storage) persisters.\n\n## Installation\n\n```bash\nember install @pollyjs/ember\n```\n\n## Configuration\n\nAddon and [server API configuration](node-server/overview#api-configuration) can be\nbe specified in `<ember app root>/config/polly.js`. The default configuration options are shown below.\n\n```js\nmodule.exports = function(env) {\n  return {\n    // Addon Configuration Options\n    enabled: env !== 'production',\n\n    // Server Configuration Options\n    server: {\n      apiNamespace: '/polly',\n      recordingsDir: 'recordings'\n    }\n  };\n};\n```\n\n## Usage\n\nOnce installed and configured, you can import and use Polly as documented. Check\nout the [Quick Start](quick-start#usage) documentation to get started.\n\n?> For an even better testing experience, check out the provided\n[QUnit Test Helper](test-frameworks/qunit)!\n"
  },
  {
    "path": "docs/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>Polly.JS</title>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" />\n    <meta\n      name=\"description\"\n      content=\"Standalone, framework-agnostic JavaScript library that enables recording, replaying, and stubbing HTTP interactions.\"\n    />\n    <meta\n      name=\"viewport\"\n      content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"\n    />\n    <meta name=\"twitter:title\" content=\"Polly.JS\" />\n    <meta\n      name=\"twitter:description\"\n      content=\"Standalone, framework-agnostic JavaScript library that enables recording, replaying, and stubbing HTTP interactions.\"\n    />\n    <meta\n      name=\"twitter:image\"\n      content=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt-twitter.png\"\n    />\n    <meta name=\"twitter:card\" content=\"summary_large_image\" />\n    <link\n      rel=\"shortcut icon\"\n      href=\"assets/images/favicon.ico\"\n      type=\"image/x-icon\"\n    />\n    <link rel=\"icon\" href=\"assets/images/favicon.ico\" type=\"image/x-icon\" />\n    <link rel=\"stylesheet\" href=\"//unpkg.com/docsify/lib/themes/vue.css\" />\n    <link rel=\"stylesheet\" href=\"assets/styles.css\" />\n  </head>\n\n  <body>\n    <div id=\"app\"></div>\n\n    <script>\n      window.$docsify = {\n        name: 'Polly.JS',\n        logo: 'assets/images/logo.png',\n        loadSidebar: true,\n        coverpage: true,\n        onlyCover: true,\n        auto2top: true,\n        autoHeader: false,\n        subMaxLevel: 3,\n        maxLevel: 4,\n        repo: 'https://github.com/Netflix/pollyjs',\n        alias: {\n          '/.*/_sidebar.md': '/_sidebar.md',\n          '.*?/CHANGELOG':\n            'https://raw.githubusercontent.com/Netflix/pollyjs/master/CHANGELOG',\n          '.*?/CONTRIBUTING':\n            'https://raw.githubusercontent.com/Netflix/pollyjs/master/CONTRIBUTING'\n        },\n        homepage:\n          'https://raw.githubusercontent.com/Netflix/pollyjs/master/README.md',\n        search: {\n          paths: 'auto',\n          placeholder: 'Search',\n          noData: 'No Results.'\n        },\n        ga: 'UA-120716183-1'\n      };\n    </script>\n    <script src=\"//unpkg.com/docsify/lib/docsify.min.js\"></script>\n    <script src=\"//unpkg.com/prismjs/components/prism-bash.min.js\"></script>\n    <script src=\"//unpkg.com/prismjs/components/prism-json.min.js\"></script>\n    <script src=\"//unpkg.com/docsify/lib/plugins/search.min.js\"></script>\n    <script src=\"//unpkg.com/docsify/lib/plugins/external-script.min.js\"></script>\n    <script src=\"//unpkg.com/docsify-copy-code@2\"></script>\n    <script src=\"//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js\"></script>\n    <script src=\"//unpkg.com/docsify/lib/plugins/ga.min.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "docs/node-server/express-integrations.md",
    "content": "# Express Integrations\n\nThe `@pollyjs/node-server` package exports a `registerExpressAPI` method which\ntakes in an [Express](http://expressjs.com/) app and a config to register the\nnecessary routes to be used with the REST Persister.\n\n```js\nconst { registerExpressAPI } = require('@pollyjs/node-server');\n\nregisterExpressAPI(app, config);\n```\n\n## Webpack DevServer\n\n```js\nconst path = require('path');\nconst { registerExpressAPI } = require('@pollyjs/node-server');\n\nconst config = {\n  devServer: {\n    before(app) {\n      registerExpressAPI(app, config);\n    }\n  }\n};\n\nmodule.exports = config;\n```\n\n## Ember CLI\n\nSee the [Ember CLI Addon](frameworks/ember-cli) documentation for more details.\n"
  },
  {
    "path": "docs/node-server/overview.md",
    "content": "# Overview\n\nThe `@pollyjs/node-server` package provides a standalone node server as well as\nan express integration to be able to support the [REST Persister](persisters/rest)\nso recordings can be saved to and read from disk.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/node-server -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/node-server -D\n```\n\n## Server\n\nThis packages includes a fully working standalone node server that is pre-configured\nwith the necessary APIs and middleware to support the [REST Persister](persisters/rest).\n\nThe Server constructor accepts a configuration object that can be a combination\nof the below listed Server & API options. Once instantiated, you will have\nfull access to the Express app via the `app` property.\n\n```js\nconst { Server } = require('@pollyjs/node-server');\nconst server = new Server({\n  quiet: true,\n  port: 4000,\n  apiNamespace: '/polly'\n});\n\n// Add custom business logic to the express server\nserver.app.get('/custom', () => {\n  /* Add custom express logic */\n});\n\n// Start listening and attach extra logic to the http server\nserver.listen().on('error', () => {\n  /* Add http server error logic */\n});\n```\n\n## Server Configuration\n\n### port\n\n_Type_: `Number`\n_Default_: `3000`\n\n```js\nnew Server({\n  port: 4000\n});\n```\n\n### host\n\n_Type_: `String`\n_Default_: `undefined`\n\n```js\nnew Server({\n  host: 'test.localhost'\n});\n```\n\n### quiet\n\n_Type_: `Boolean`\n_Default_: `false`\n\nEnable/Disable the logging middleware ([morgan](https://github.com/expressjs/morgan)).\n\n```js\nnew Server({\n  quiet: true\n});\n```\n\n### corsOptions\n\n_Type_: `Object | Function`\n_Default_: `undefined`\n\nOptions passed to the ([CORS](https://github.com/expressjs/cors)) middleware.\n\n```js\nnew Server({\n  corsOptions: {\n    origin: 'http://localhost:4000',\n    credentials: true\n  }\n});\n```\n\n## API Configuration\n\n### recordingsDir\n\n_Type_: `String`\n_Default_: `'recordings'`\n\nThe root directory to store all recordings.\n\n```js\nnew Server({\n  recordingsDir: '__recordings__'\n});\n\nregisterExpressAPI(app, {\n  recordingsDir: '__recordings__'\n});\n```\n\n### apiNamespace\n\n_Type_: `String`\n_Default_: `'polly'`\n\nThe namespace to mount the polly API on. This should really only be changed\nif there is a conflict with the default apiNamespace.\n\n!> If modified, you must provide the new `apiNamespace` to the client side Polly\ninstance via the [Persister Options](persisters/rest#apinamespace)\n\n```js\nnew Server({\n  apiNamespace: '/polly'\n});\n\nregisterExpressAPI(app, {\n  apiNamespace: '/polly'\n});\n```\n\n### recordingSizeLimit\n\n_Type_: `String`\n_Default_: `'50mb'`\n\nA recording size can not exceed 50mb by default. If your application exceeds this limit, bump this value to a reasonable limit.\n\n```js\nnew Server({\n  recordingSizeLimit: '50mb'\n});\n\nregisterExpressAPI(app, {\n  recordingSizeLimit: '50mb'\n});\n```\n"
  },
  {
    "path": "docs/persisters/custom.md",
    "content": "# Custom Persister\n\nIf you need to create your own persister or modify an pre-existing one, you've come\nto the right page!\n\n## Creating a Custom Persister\n\nThe `@pollyjs/persister` package provides an extendable base persister class that\ncontains core logic dependent on by the [REST](persisters/rest)\n& [Local Storage](persisters/local-storage) persisters.\n\n### Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister -D\n```\n\n### Usage\n\n```js\nimport Persister from '@pollyjs/persister';\n\nclass CustomPersister extends Persister {\n  static get id() {\n    return 'custom';\n  }\n\n  onFindRecording() {}\n\n  onSaveRecording() {}\n\n  onDeleteRecording() {}\n}\n```\n\nFor better usage examples, please refer to the source code for\nthe [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.\n\n## Extending from an Existing Persister\n\nThe `@pollyjs/core` package exports the `RESTPersister` and `LocalStoragePersister` classes,\nallowing you to modify them as needed.\n\n```js\nimport RESTPersister from '@pollyjs/persister-rest';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\nclass CustomRESTPersister extends RESTPersister {}\nclass CustomLocalStoragePersister extends LocalStoragePersister {}\n```\n\n## Registering & Connecting to a Custom Persister\n\nYou can register and connect to a custom persister by passing an array to the `persister`\nconfig where the first element is the name of your persister and the second is the\npersister class.\n\n```js\n// Register and connect to a custom persister:\nnew Polly('Custom Persister', {\n  persister: MyCustomPersisterClass\n});\n\n// Register and connect to a custom persister via .configure():\nconst polly = new Polly('Custom Persister');\n\npolly.configure({\n  persister: MyCustomPersisterClass\n});\n```\n"
  },
  {
    "path": "docs/persisters/fs.md",
    "content": "# File System Persister\n\nRead and write recordings to and from the file system.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-fs -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-fs -D\n```\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FSPersister from '@pollyjs/persister-fs';\n\n// Register the fs persister so its accessible by all future polly instances\nPolly.register(FSPersister);\n\nnew Polly('<Recording Name>', {\n  persister: 'fs'\n});\n```\n\n## Options\n\n### recordingsDir\n\n_Type_: `String`\n_Default_: `'recordings'`\n\nThe root directory to store all recordings. Supports both relative and\nabsolute paths.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    fs: {\n      recordingsDir: '__recordings__'\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/persisters/local-storage.md",
    "content": "# Local Storage Persister\n\nRead and write recordings to and from the browser's Local Storage.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-local-storage -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-local-storage -D\n```\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\nnew Polly('<Recording Name>', {\n  persister: 'local-storage'\n});\n```\n\n## Options\n\n### context\n\n_Type_: `Object`\n_Default_: `global|self|window`\n\nThe context object which contains the localStorage API.\nTypically this is `window` or `self` in the browser and `global` in node.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    'local-storage': {\n      context: window\n    }\n  }\n});\n```\n\n### key\n\n_Type_: `String`\n_Default_: `'pollyjs'`\n\nThe localStorage key to store the recordings data under.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    'local-storage': {\n      key: '__pollyjs__'\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/persisters/rest.md",
    "content": "# REST Persister\n\nRead and write recordings to and from the file system via a CRUD API hosted\non a server.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-rest -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-rest -D\n```\n\n## Setup\n\nThis library provides a fully functional [node server](node-server/overview)\nas well as a [CLI](cli/overview) to get you up and running.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport RESTPersister from '@pollyjs/persister-rest';\n\n// Register the rest persister so its accessible by all future polly instances\nPolly.register(RESTPersister);\n\nnew Polly('<Recording Name>', {\n  persister: 'rest'\n});\n```\n\n## Options\n\n### host\n\n_Type_: `String`\n_Default_: `'http://localhost:3000'`\n\nThe host that the API exists on.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    rest: {\n      host: 'http://localhost.com:4000'\n    }\n  }\n});\n```\n\n### apiNamespace\n\n_Type_: `String`\n_Default_: `'/polly'`\n\nThe API namespace.\n\nThe namespace the Polly API is mounted on. This should really only be changed\nif there is a conflict with the default apiNamespace.\n\n!> If modified, you must provide the new `apiNamespace` to the node server\nvia the [Node Server apiNamespace](node-server/overview#apinamespace) configuration\noption.\n\n**Example**\n\n```js\npolly.configure({\n  persisterOptions: {\n    rest: {\n      apiNamespace: '/polly'\n    }\n  }\n});\n```\n"
  },
  {
    "path": "docs/quick-start.md",
    "content": "# Quick Start\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/core -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/core -D\n```\n\n## How it Works\n\nOnce instantiated, Polly will hook into native implementations (such as fetch & XHR)\nvia adapters to intercept any outgoing requests. Depending on its current\n[mode](configuration#mode) as well as rules defined via the\n[client-side server](server/overview), the request will either be replayed, recorded,\npassed-through, or intercepted.\n\n## Adapters & Persisters\n\nBefore you start using Polly, you'll need to install the necessary adapters and\npersisters depending on your application/environment. Adapters provide\nfunctionality that allows Polly to intercept requests via different sources\n(e.g. XHR, fetch, Puppeteer) while Persisters provide the functionality to read & write\nrecorded data (e.g. fs, local-storage).\n\nCheck out the appropriate documentation pages for each adapter and persister\nfor more details such as installation, usage, and available options.\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-{name} -D\nnpm install @pollyjs/persister-{name} -D\n```\n\nIf you want to install them with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-{name} -D\nyarn add @pollyjs/persister-{name} -D\n```\n\nOnce installed, you can register the adapters and persisters with Polly so\nthey can easily be referenced by name later.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\nPolly.register(FetchAdapter);\nPolly.register(XHRAdapter);\nPolly.register(LocalStoragePersister);\n\nnew Polly('<Recording Name>', {\n  adapters: ['fetch', 'xhr'],\n  persister: 'local-storage'\n});\n```\n\n## Using Polly in the Browser?\n\nPolly fully supports native in-browser usage, but because browsers can't write\nto disk in the same way as conventional applications considerations need to be\nmade for persisting recordings.\n\nIf permanent, long-term persistence is not required then you can simply use the\n[Local Storage Persister](persisters/local-storage), which writes to\n`window.localStorage`.\n\nFor conventional file system storage you will need to use the\n[REST Persister](persisters/rest) which runs as a separate process listening for\nPollyJS activity. The server can be run in 2 ways. Firstly via the provided\n[CLI](cli/overview)'s [listen](cli/commands#listen) command:\n\n```bash\nnpm install @pollyjs/cli -g\npolly listen\n```\n\nHowever, secondly there is also a convenient\n[Express Integration](node-server/express-integrations) that appends the REST\nserver's endpoints to an existing server such as\n[Webpack's Dev Server](https://webpack.js.org/configuration/dev-server/).\n\n## Usage\n\nNow that you've installed and setup Polly, you're ready to fly. Lets take a\nlook at what a simple example test case would look like using Polly.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\n/*\n  Register the adapters and persisters we want to use. This way all future\n  polly instances can access them by name.\n*/\nPolly.register(FetchAdapter);\nPolly.register(LocalStoragePersister);\n\ndescribe('Simple Example', function () {\n  it('fetches a post', async function () {\n    /*\n      Create a new polly instance.\n\n      Connect Polly to fetch. By default, it will record any requests that it\n      hasn't yet seen while replaying ones it has already recorded.\n    */\n    const polly = new Polly('Simple Example', {\n      adapters: ['fetch'], // Hook into `fetch`\n      persister: 'local-storage', // Read/write to/from local-storage\n      logLevel: 'info' // Log requests to console\n    });\n\n    const response = await fetch(\n      'https://jsonplaceholder.typicode.com/posts/1'\n    );\n    const post = await response.json();\n\n    expect(response.status).to.equal(200);\n    expect(post.id).to.equal(1);\n\n    /*\n      Calling `stop` will persist requests as well as disconnect from any\n      connected adapters.\n    */\n    await polly.stop();\n  });\n});\n```\n\n<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>\n<script async src=\"https://static.codepen.io/assets/embed/ei.js\"></script>\n\nThe first time the test runs, Polly will record the response for the\n`fetch('https://jsonplaceholder.typicode.com/posts/1')` request that was made. You will\nsee the following in the console:\n\n```text\nRecorded ➞ GET https://jsonplaceholder.typicode.com/posts/1 200 • 48ms\n```\n\nOnce the Polly instance is [stopped](api#stop-1), the persister will generate the\nfollowing [HAR](http://www.softwareishard.com/blog/har-12-spec/) file which will\nbe used to replay the response to that request when the test is rerun:\n\n```json\n{\n  \"Simple-Example_823972681\": {\n    \"log\": {\n      \"_recordingName\": \"Simple Example\",\n      \"browser\": {\n        \"name\": \"Chrome\",\n        \"version\": \"70.0\"\n      },\n      \"creator\": {\n        \"comment\": \"persister:local-storage\",\n        \"name\": \"Polly.JS\",\n        \"version\": \"1.2.0\"\n      },\n      \"entries\": [\n        {\n          \"_id\": \"ffbc4836d419fc265c3b85cbe1b7f22e\",\n          \"_order\": 0,\n          \"cache\": {},\n          \"request\": {\n            \"bodySize\": 0,\n            \"cookies\": [],\n            \"headers\": [],\n            \"headersSize\": 63,\n            \"httpVersion\": \"HTTP/1.1\",\n            \"method\": \"GET\",\n            \"queryString\": [],\n            \"url\": \"https://jsonplaceholder.typicode.com/posts/1\"\n          },\n          \"response\": {\n            \"bodySize\": 292,\n            \"content\": {\n              \"mimeType\": \"application/json; charset=utf-8\",\n              \"size\": 292,\n              \"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}\"\n            },\n            \"cookies\": [],\n            \"headers\": [\n              {\n                \"name\": \"cache-control\",\n                \"value\": \"public, max-age=14400\"\n              },\n              {\n                \"name\": \"content-type\",\n                \"value\": \"application/json; charset=utf-8\"\n              },\n              {\n                \"name\": \"expires\",\n                \"value\": \"Tue, 30 Oct 2018 22:52:42 GMT\"\n              },\n              {\n                \"name\": \"pragma\",\n                \"value\": \"no-cache\"\n              }\n            ],\n            \"headersSize\": 145,\n            \"httpVersion\": \"HTTP/1.1\",\n            \"redirectURL\": \"\",\n            \"status\": 200,\n            \"statusText\": \"OK\"\n          },\n          \"startedDateTime\": \"2018-10-30T18:52:42.566Z\",\n          \"time\": 18,\n          \"timings\": {\n            \"blocked\": -1,\n            \"connect\": -1,\n            \"dns\": -1,\n            \"receive\": 0,\n            \"send\": 0,\n            \"ssl\": -1,\n            \"wait\": 18\n          }\n        }\n      ],\n      \"pages\": [],\n      \"version\": \"1.2\"\n    }\n  }\n}\n```\n\nThe next time the test is run, Polly will use the recorded response instead\nof going out to the server to get a new one. You will see the following in the\nconsole:\n\n```text\nReplayed ➞ GET https://jsonplaceholder.typicode.com/posts/1 200 • 1ms\n```\n\n## Client-Side Server\n\nEvery Polly instance has a reference to a [client-side server](server/overview)\nwhich you can leverage to gain full control of all HTTP interactions as well as\ndictate how the Polly instance should handle them.\n\nLets take a look at how we can modify our previous test case to test against a\npost that does not exist.\n\n```js\ndescribe('Simple Client-Side Server Example', function () {\n  it('fetches an unknown post', async function () {\n    /*\n      Create a new polly instance.\n\n      Connect Polly to fetch. By default, it will record any requests that it\n      hasn't yet seen while replaying ones it has already recorded.\n    */\n    const polly = new Polly('Simple Client-Side Server Example', {\n      adapters: ['fetch'], // Hook into `fetch`\n      persister: 'local-storage', // Read/write to/from local-storage\n      logLevel: 'info' // Log requests to console\n    });\n    const { server } = polly;\n\n    /*\n      Add a rule via the client-side server to intercept the\n      `https://jsonplaceholder.typicode.com/posts/404` request and return\n      an error.\n    */\n    server\n      .get('https://jsonplaceholder.typicode.com/posts/404')\n      .intercept((req, res) => {\n        res.status(404).json({ error: 'Post not found.' });\n      });\n\n    const response = await fetch(\n      'https://jsonplaceholder.typicode.com/posts/404'\n    );\n    const post = await response.json();\n\n    expect(response.status).to.equal(404);\n    expect(post.error).to.equal('Post not found.');\n\n    /*\n      Calling `stop` will persist requests as well as disconnect from any\n      connected adapters.\n    */\n    await polly.stop();\n  });\n});\n```\n\n<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>\n<script async src=\"https://static.codepen.io/assets/embed/ei.js\"></script>\n\nWhen the test executes, Polly will detect that we've set a custom intercept rule for\n`https://jsonplaceholder.typicode.com/posts/404` and will deffer to the intercept handler\nto handle the response for that request. You will see the following in the console:\n\n```text\nIntercepted ➞ GET https://jsonplaceholder.typicode.com/posts/404 404 • 1ms\n```\n\n## Test Helpers\n\nUsing Mocha or QUnit? We've got you covered! Checkout the [Mocha](test-frameworks/mocha) or\n[QUnit](test-frameworks/qunit) documentation pages for detailed instructions\non how to use the provided test helpers.\n"
  },
  {
    "path": "docs/server/api.md",
    "content": "# API\n\n## HTTP Methods\n\nThe `GET`, `PUT`, `POST`, `PATCH`, `DELETE`, `MERGE`, `HEAD`, and `OPTIONS` HTTP methods\nhave a corresponding method on the server instance.\n\n```js\nserver.get('/ping');\nserver.put('/ping');\nserver.post('/ping');\nserver.patch('/ping');\nserver.delete('/ping');\nserver.merge('/ping');\nserver.head('/ping');\nserver.options('/ping');\n```\n\nEach of these methods returns a [Route Handler](server/route-handler.md) which\nyou can use to pass-through, intercept, and attach events to.\n\n```js\nserver.get('/ping').passthrough();\nserver.put('/ping').intercept((req, res) => res.sendStatus(200));\nserver.post('/ping').on('request', req => {\n  /* Do Something */\n});\nserver.patch('/ping').off('request');\n```\n\n## any\n\nDeclare [Events & Middleware](server/events-and-middleware#middleware) globally\nor for a specific route.\n\n**Example**\n\n```js\nserver.any('/session/:id').on('request', (req, res) => {\n  req.query.email = 'test@netflix.com';\n});\n```\n\n## host\n\nDefine a block where all methods will inherit the provided host.\n\n**Example**\n\n```js\nserver.host('http://netflix.com', () => {\n  // Middleware will be attached to the host\n  server.any().on('request', req => {});\n\n  server.get('/session').intercept(() => {}); // → http://netflix.com/session\n});\n```\n\n## namespace\n\nDefine a block where all methods will inherit the provided namespace.\n\n**Example**\n\n```js\nserver.namespace('/api', () => {\n  // Middleware will be attached to the namespace\n  server.any().on('request', req => {});\n\n  server.get('/session').intercept(() => {}); // → /api/session\n\n  server.namespace('/v2', () => {\n    server.get('/session').intercept(() => {}); // → /api/v2/session\n  });\n});\n```\n\n## timeout\n\nReturns a promise that will resolve after the given number of milliseconds.\n\n**Example**\n\n```js\nserver.get('/ping').intercept(async (req, res) => {\n  await server.timeout(500);\n  res.sendStatus(200);\n});\n```\n"
  },
  {
    "path": "docs/server/event.md",
    "content": "# Event\n\n## Properties\n\n### type\n\n_Type_: `String`\n\nThe event type. (e.g. `request`, `response`, `beforePersist`)\n\n## Methods\n\n### stopPropagation\n\nIf 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.\n\n**Example**\n\n```js\nserver.get('/session/:id').on('beforeResponse', (req, res, event) => {\n  event.stopPropagation();\n  res.setHeader('X-SESSION-ID', 'ABC123');\n});\n\nserver.get('/session/:id').on('beforeResponse', (req, res, event) => {\n  // This will never be reached\n  res.setHeader('X-SESSION-ID', 'XYZ456');\n});\n```\n"
  },
  {
    "path": "docs/server/events-and-middleware.md",
    "content": "# Events & Middleware\n\n## Events\n\nEvents can be attached to a server route using `.on()` and detached via\nthe `.off()` methods.\n\n?> **NOTE:** Event handlers can be asynchronous. An `async` function can be used\nor a `Promise` can be returned.\n\n```js\n// Events\nserver\n  .get('/')\n  .on('request', req => {})\n  .off('request');\n\n// Passthrough w/ Events\nserver\n  .get('/')\n  .passthrough()\n  .on('beforeResponse', (req, res) => {})\n  .off('beforeResponse');\n\n// Intercept w/ Events\nserver\n  .get('/', (req, res) => {})\n  .on('request', req => {})\n  .on('beforeResponse', (req, res) => {});\n\n// Middleware w/ Events\nserver\n  .any('/')\n  .on('request', req => {})\n  .on('beforeResponse', (req, res) => {});\n```\n\n### request\n\nFires right before the request goes out.\n\n| Param | Type                      | Description          |\n| ----- | ------------------------- | -------------------- |\n| req   | [Request](server/request) | The request instance |\n| event | [Event](server/event)     | The event instance   |\n\n**Example**\n\n```js\nserver.get('/session').on('request', req => {\n  req.headers['X-AUTH'] = '<ACCESS_TOKEN>';\n  req.query.email = 'test@app.com';\n});\n```\n\n### beforeResponse\n\nFires right before the response materializes and the promise resolves.\n\n| Param | Type                        | Description           |\n| ----- | --------------------------- | --------------------- |\n| req   | [Request](server/request)   | The request instance  |\n| res   | [Response](server/response) | The response instance |\n| event | [Event](server/event)       | The event instance    |\n\n**Example**\n\n```js\nserver.get('/session').on('beforeResponse', (req, res) => {\n  res.setHeader('X-AUTH', '<ACCESS_TOKEN>');\n});\n```\n\n### response\n\nFires right after the response has been finalized for the request but before\nthe response materializes and the promise resolves.\n\n| Param | Type                        | Description           |\n| ----- | --------------------------- | --------------------- |\n| req   | [Request](server/request)   | The request instance  |\n| res   | [Response](server/response) | The response instance |\n| event | [Event](server/event)       | The event instance    |\n\n**Example**\n\n```js\nserver.get('/session').on('response', (req, res) => {\n  console.log(\n    `${req.url} took ${req.responseTime}ms with a status of ${res.statusCode}.`\n  );\n});\n```\n\n### beforePersist\n\nFires before the request/response gets persisted.\n\n| Param     | Type                      | Description                          |\n| --------- | ------------------------- | ------------------------------------ |\n| req       | [Request](server/request) | The request instance                 |\n| recording | `Object`                  | The recording that will be persisted |\n| event     | [Event](server/event)     | The event instance                   |\n\n**Example**\n\n```js\nserver.any().on('beforePersist', (req, recording) => {\n  recording.request = encrypt(recording.request);\n  recording.response = encrypt(recording.response);\n});\n```\n\n### beforeReplay\n\nFires after retrieving the recorded request/response from the persister\nand before the recording materializes into a response.\n\n| Param     | Type                      | Description             |\n| --------- | ------------------------- | ----------------------- |\n| req       | [Request](server/request) | The request instance    |\n| recording | `Object`                  | The retrieved recording |\n| event     | [Event](server/event)     | The event instance      |\n\n**Example**\n\n```js\nserver.any().on('beforeReplay', (req, recording) => {\n  recording.request = decrypt(recording.request);\n  recording.response = decrypt(recording.response);\n});\n```\n\n### error\n\nFires when any error gets emitted during the request life-cycle.\n\n| Param | Type                      | Description          |\n| ----- | ------------------------- | -------------------- |\n| req   | [Request](server/request) | The request instance |\n| error | Error                     | The error            |\n| event | [Event](server/event)     | The event instance   |\n\n**Example**\n\n```js\nserver.any().on('error', (req, error) => {\n  console.error(error);\n  process.exit(1);\n});\n```\n\n### abort\n\nFires when a request is aborted.\n\n| Param | Type                      | Description          |\n| ----- | ------------------------- | -------------------- |\n| req   | [Request](server/request) | The request instance |\n| event | [Event](server/event)     | The event instance   |\n\n**Example**\n\n```js\nserver.any().on('abort', req => {\n  console.error('Request aborted.');\n  process.exit(1);\n});\n```\n\n## Middleware\n\nMiddleware can be added via the `.any()` method.\n\n?> **NOTE:** Middleware events will be executed by the order in which they were\ndeclared.\n\n### Global Middleware\n\nThe following is an example of a global middleware that will be attached to all\nroutes. This middleware in specific overrides the `X-Auth-Token` with a test token.\n\n```js\nserver.any().on('request', (req, res) => {\n  req.headers['X-Auth-Token'] = 'abc123';\n});\n```\n\n### Route Level Middleware\n\nThe following is an example of a route level middleware that will be attached to\nany route that matches `/session/:id`. This middleware in specific overrides\nthe email query param with that of a test email.\n\n```js\nserver.any('/session/:id').on('request', (req, res) => {\n  req.query.email = 'test@netflix.com';\n});\n```\n"
  },
  {
    "path": "docs/server/overview.md",
    "content": "# Overview\n\nEvery polly instance has a reference to a client-side server which you can leverage\nto gain full control of all HTTP interactions as well as dictate how the Polly instance\nshould handle them.\n\n## Usage\n\n```js\nconst polly = new Polly('<Recording Name>');\nconst { server } = polly;\n\n// Events & Middleware\nserver.any().on('request', (req, res) => {\n  req.headers['X-Auth-Token'] = 'abc123';\n});\n\n// Intercept requests\nserver.get('/session').intercept((req, res) => {\n  res.status(200).json({ user: { email: 'test@netflix.com' } });\n});\n\n// Passthrough requests\nserver.get('/coverage').passthrough();\n```\n\n## Defining Routes\n\nThe server uses [Route Recognizer](https://github.com/tildeio/route-recognizer)\nunder the hood. This allows you to define static routes, as well as dynamic,\nand starred segments.\n\n**Example**\n\n```js\n// Static Routes\nserver.get('/api/v2/users').intercept((req, res) => {\n  res.sendStatus(200);\n});\n\n// Dynamic Segments\nserver.get('http://netflix.com/movies/:id').intercept((req, res) => {\n  console.log(req.params.id); // http://netflix.com/movies/1 → '1'\n  res.sendStatus(200);\n});\n\n// Starred Segments\nserver.get('/secrets/*path').intercept((req, res) => {\n  console.log(req.params.path); // /secrets/foo/bar → 'foo/bar'\n  res.status(401).send('Shhh!');\n});\n```\n\n### Multi Route Handlers\n\nHTTPS methods as well as `.any()` accept a single string\nas well as an array of strings.\n\n**Example**\n\n```js\n// Match against '/api/v2/users' as well as any child route\nserver.get(['/api/v2/users', '/api/v2/users/*path']).passthrough();\n\n// Register the same event handler on both '/session' and '/users/session'\nserver.any(['/session', '/users/session']).on('request', () => {});\n```\n"
  },
  {
    "path": "docs/server/request.md",
    "content": "# 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_Type_: `String`\n\nThe request URL.\n\n### protocol\n\n_Type_: `String`\n\nThe request url protocol. (e.g. `http://`, `https:`)\n\n### hostname\n\n_Type_: `String`\n\nThe request url host name. (e.g. `localhost`, `netflix.com`)\n\n### port\n\n_Type_: `String`\n\nThe request url port. (e.g. `3000`)\n\n### pathname\n\n_Type_: `String`\n\nThe request url path name. (e.g. `/session`, `/movies/1`)\n\n### hash\n\n_Type_: `String`\n\nThe request url hash.\n\n### headers\n\n_Type_: `Object`\n_Default_: `{}`\n\nThe request headers.\n\n### body\n\n_Type_: `any`\n\nThe request body.\n\n### query\n\n_Type_: `Object`\n_Default_: `{}`\n\nThe request url query parameters.\n\n### params\n\n_Type_: `Object`\n_Default_: `{}`\n\nThe matching route's path params.\n\n**Example**\n\n```js\nserver.get('/movies/:id').intercept((req, res) => {\n  console.log(req.params.id);\n});\n```\n\n### recordingName\n\n_Type_: `String`\n\nThe recording the request should be recorded under.\n\n## Methods\n\n### getHeader\n\nGet a header with a given name.\n\n| Param       | Type                | Description            |\n| ----------- | ------------------- | ---------------------- |\n| name        | `String`            | The name of the header |\n| **Returns** | `String` \\| `Array` | The header value       |\n\n**Example**\n\n```js\nreq.getHeader('Content-Type'); // → application/json\n```\n\n### setHeader\n\nSet a header with a given name. If the value is `null` or `undefined`, the header will be\nremoved.\n\n| Param       | Type                      | Description              |\n| ----------- | ------------------------- | ------------------------ |\n| name        | `String`                  | The name of the header   |\n| value       | `String` \\| `Array`       | The value for the header |\n| **Returns** | [Request](server/request) | The current request      |\n\n**Example**\n\n```js\nreq.setHeader('Content-Length', 42);\n```\n\n### setHeaders\n\nAdd multiple headers at once. If a value is `null` or `undefined`, the header will be\nremoved.\n\n| Param       | Type                      | Description                       |\n| ----------- | ------------------------- | --------------------------------- |\n| headers     | `Object`                  | The headers to add to the request |\n| **Returns** | [Request](server/request) | The current request               |\n\n**Example**\n\n```js\nreq.setHeaders({\n  Accept: ['text/html', 'image/*'],\n  'Content-Type': 'application/json',\n  'Content-Length': 42\n});\n```\n\n### removeHeader\n\nRemove a header with the given name.\n\n| Param       | Type                      | Description            |\n| ----------- | ------------------------- | ---------------------- |\n| name        | `String`                  | The name of the header |\n| **Returns** | [Request](server/request) | The current request    |\n\n**Example**\n\n```js\nreq.removeHeader('Content-Length');\n```\n\n### removeHeaders\n\nRemove multiple headers at once.\n\n| Param       | Type                      | Description                            |\n| ----------- | ------------------------- | -------------------------------------- |\n| headers     | `Array`                   | The headers to remove from the request |\n| **Returns** | [Request](server/request) | The current request                    |\n\n**Example**\n\n```js\nreq.removeHeaders(['Content-Type' 'Content-Length']);\n```\n\n### hasHeader\n\nReturns 'true' or 'false' depending on if the request has the given header.\n\n| Param       | Type      | Description            |\n| ----------- | --------- | ---------------------- |\n| name        | `String`  | The name of the header |\n| **Returns** | `Boolean` | &nbsp;                 |\n\n**Example**\n\n```js\nreq.hasHeader('X-AUTH'); // → false\n```\n\n### type\n\nSets the request's Content Type.\n\n| Param       | Type                      | Description         |\n| ----------- | ------------------------- | ------------------- |\n| value       | `String`                  | &nbsp;              |\n| **Returns** | [Request](server/request) | The current request |\n\n### send\n\nSets the request's body.\n\n- If the body is a `String`, it defaults the content type to `text/html` if does not exist.\n- If the body is a `String` and no charset is found, a `utf-8` charset is appended to the content type.\n- Body that is a `Boolean`, `Number`, or `Object` gets passed to the [json](#json) method.\n\n| Param       | Type                      | Description         |\n| ----------- | ------------------------- | ------------------- |\n| body        | `any`                     | &nbsp;              |\n| **Returns** | [Request](server/request) | The current request |\n\n**Example**\n\n```js\nreq.send('Hello World');\nreq.send(200);\nreq.send(true);\nreq.send();\n```\n\n### json\n\nA shortcut method to set the content type to `application/json` if it hasn't\nbeen set already, and call [send](#send) with the stringified object.\n\n| Param       | Type                      | Description         |\n| ----------- | ------------------------- | ------------------- |\n| obj         | `Object`                  | Object to send      |\n| **Returns** | [Request](server/request) | The current request |\n\n**Example**\n\n```js\nreq.json({ Hello: 'World' });\n```\n\n### jsonBody\n\nA shortcut method that calls JSON.parse on the request's body.\n\n!> This method will throw if the body is an invalid JSON string.\n\n| Param       | Type     | Description          |\n| ----------- | -------- | -------------------- |\n| **Returns** | `Object` | The JSON parsed body |\n\n**Example**\n\n```js\nreq.jsonBody();\n```\n\n### overrideRecordingName\n\nOverride the recording name for the request.\n\n| Param         | Type     | Description            |\n| ------------- | -------- | ---------------------- |\n| recordingName | `String` | The new recording name |\n\n**Example**\n\n```js\nreq.overrideRecordingName(req.hostname);\n```\n\n### configure\n\nOverride configuration options for the request.\n\n| Param  | Type     | Description                           |\n| ------ | -------- | ------------------------------------- |\n| config | `Object` | [Configuration](configuration) object |\n\n**Example**\n\n```js\nreq.configure({ recordFailedRequests: true });\n\nreq.configure({ timing: Timing.relative(3.0) });\n\nreq.configure({ logLevel: 'info' });\n```\n"
  },
  {
    "path": "docs/server/response.md",
    "content": "# Response\n\n## Properties\n\n### statusCode\n\n_Type_: `Number`\n_Default_: `undefined`\n\nThe response's status code.\n\n### headers\n\n_Type_: `Object`\n_Default_: `{}`\n\nThe response's headers.\n\n### body\n\n_Type_: `String`\n_Default_: `undefined`\n\nThe response's body.\n\n## Methods\n\n### status\n\nSet the response's status code.\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| status      | `Number`                    | Status code          |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.status(200);\n```\n\n### getHeader\n\nGet a header with a given name.\n\n| Param       | Type                | Description            |\n| ----------- | ------------------- | ---------------------- |\n| name        | `String`            | The name of the header |\n| **Returns** | `String` \\| `Array` | The header value       |\n\n**Example**\n\n```js\nres.getHeader('Content-Type'); // → application/json\n```\n\n### setHeader\n\nSet a header with a given name. If the value is `null` or `undefined`, the header will be\nremoved.\n\n| Param       | Type                        | Description              |\n| ----------- | --------------------------- | ------------------------ |\n| name        | `String`                    | The name of the header   |\n| value       | `String` \\| `Array`         | The value for the header |\n| **Returns** | [Response](server/response) | The current response     |\n\n**Example**\n\n```js\nres.setHeader('Content-Length', 42);\n```\n\n### setHeaders\n\nAdd multiple headers at once. If a value is `null` or `undefined`, the header will be\nremoved.\n\n| Param       | Type                        | Description                        |\n| ----------- | --------------------------- | ---------------------------------- |\n| headers     | `Object`                    | The headers to add to the response |\n| **Returns** | [Response](server/response) | The current response               |\n\n**Example**\n\n```js\nres.setHeaders({\n  Accept: ['text/html', 'image/*'],\n  'Content-Type': 'application/json',\n  'Content-Length': 42\n});\n```\n\n### removeHeader\n\nRemove a header with the given name.\n\n| Param       | Type                        | Description            |\n| ----------- | --------------------------- | ---------------------- |\n| name        | `String`                    | The name of the header |\n| **Returns** | [Response](server/response) | The current response   |\n\n**Example**\n\n```js\nres.removeHeader('Content-Length');\n```\n\n### removeHeaders\n\nRemove multiple headers at once.\n\n| Param       | Type                        | Description                             |\n| ----------- | --------------------------- | --------------------------------------- |\n| headers     | `Array`                     | The headers to remove from the response |\n| **Returns** | [Response](server/response) | The current response                    |\n\n**Example**\n\n```js\nres.removeHeaders(['Content-Type' 'Content-Length']);\n```\n\n### hasHeader\n\nReturns 'true' or 'false' depending on if the response has the given header.\n\n| Param       | Type      | Description            |\n| ----------- | --------- | ---------------------- |\n| name        | `String`  | The name of the header |\n| **Returns** | `Boolean` | &nbsp;                 |\n\n**Example**\n\n```js\nres.hasHeader('X-AUTH'); // → false\n```\n\n### type\n\nSets the response's Content Type.\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| value       | `String`                    | &nbsp;               |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.type('application/json');\n```\n\n### send\n\nSets the response's body.\n\n- If the body is a `String`, it defaults the content type to `text/html` if does not exist.\n- If the body is a `String` and no charset is found, a `utf-8` charset is appended to the content type.\n- Body that is a `Boolean`, `Number`, or `Object` gets passed to the [json](#json) method.\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| body        | `any`                       | &nbsp;               |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.send('Hello World');\nres.send(200);\nres.send(true);\nres.send();\n```\n\n### sendStatus\n\nA shortcut method to set the status to the given status code, set the content\ntype to `text/plain`, and call [send](#send).\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| status      | `Number`                    | Status code          |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.sendStatus(200);\n```\n\n### json\n\nA shortcut method to set the content type to `application/json` if it hasn't\nbeen set already, and call [send](#send) with the stringified object.\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| obj         | `Object`                    | Object to send       |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.json({ Hello: 'World' });\n```\n\n### jsonBody\n\nA shortcut method that calls JSON.parse on the response's body.\n\n!> This method will throw if the body is an invalid JSON string.\n\n| Param       | Type     | Description          |\n| ----------- | -------- | -------------------- |\n| **Returns** | `Object` | The JSON parsed body |\n\n**Example**\n\n```js\nres.jsonBody();\n```\n\n### end\n\nFreeze the response and headers so they can no longer be modified.\n\n| Param       | Type                        | Description          |\n| ----------- | --------------------------- | -------------------- |\n| **Returns** | [Response](server/response) | The current response |\n\n**Example**\n\n```js\nres.end();\n```\n"
  },
  {
    "path": "docs/server/route-handler.md",
    "content": "# Route Handler\n\nAn object that is returned when calling any of the server's HTTP methods as well\nas `server.any()`.\n\n## Methods\n\n?> **NOTE:** Event & Intercept handlers can be asynchronous. An `async`\nfunction can be used or a `Promise` can be returned.\n\n### on\n\nRegister an [event](server/events-and-middleware) handler.\n\n?> **Tip:** You can attach multiple handlers to a single event. Handlers will be\ncalled in the order they were declared.\n\n| Param         | Type       | Description                                                      |\n| ------------- | ---------- | ---------------------------------------------------------------- |\n| eventName     | `String`   | The event name                                                   |\n| handler       | `Function` | The event handler                                                |\n| options       | `Object`   | The event handler options                                        |\n| options.times | `number`   | Remove listener after being called the specified amount of times |\n\n**Example**\n\n```js\nserver\n  .get('/session')\n  .on('request', (req) => {\n    req.headers['X-AUTH'] = '<ACCESS_TOKEN>';\n    req.query.email = 'test@app.com';\n  })\n  .on('request', () => {\n    /* Do something else */\n  })\n  .on(\n    'request',\n    () => {\n      /* Do something else twice */\n    },\n    { times: 2 }\n  );\n```\n\n### once\n\nRegister a one-time [event](server/events-and-middleware) handler.\n\n?> **Tip:** You can attach multiple handlers to a single event. Handlers will be\ncalled in the order they were declared.\n\n| Param     | Type       | Description       |\n| --------- | ---------- | ----------------- |\n| eventName | `String`   | The event name    |\n| handler   | `Function` | The event handler |\n\n**Example**\n\n```js\nserver\n  .get('/session')\n  .once('request', (req) => {\n    req.headers['X-AUTH'] = '<ACCESS_TOKEN>';\n    req.query.email = 'test@app.com';\n  })\n  .once('request', () => {\n    /* Do something else */\n  });\n```\n\n### off\n\nUn-register an [event](server/events-and-middleware) handler. If no handler\nis specified, all event handlers are un-registered for the given event name.\n\n| Param     | Type       | Description       |\n| --------- | ---------- | ----------------- |\n| eventName | `String`   | The event name    |\n| handler   | `Function` | The event handler |\n\n**Example**\n\n```js\nconst handler = () => {};\n\nserver\n  .get('/session')\n  .on('request', , handler)\n  .on('request', () => {})\n  .off('request', handler) /* Un-register the specified event/handler pair */\n  .off('request'); /* Un-register all handlers */\n```\n\n### intercept\n\nRegister an intercept handler. Once set, the [request](server/request) will\nnever go to server but instead defer to the provided handler to handle\nthe [response](server/response). If multiple intercept handlers have been\nregistered, each handler will be called in the order in which it was registered.\n\n| Param         | Type       | Description                                                     |\n| ------------- | ---------- | --------------------------------------------------------------- |\n| handler       | `Function` | The intercept handler                                           |\n| options       | `Object`   | The event handler options                                       |\n| options.times | `number`   | Remove handler after being called the specified amount of times |\n\n**Example**\n\n```js\nserver.any('/session').intercept((req, res) => res.sendStatus(200));\n\nserver.any('/twice').intercept((req, res) => res.sendStatus(200), { times: 2 });\n\nserver.get('/session/:id').intercept((req, res, interceptor) => {\n  if (req.params.id === '1') {\n    res.status(200).json({ token: 'ABC123XYZ' });\n  } else if (req.params.id === '2') {\n    res.status(404).json({ error: 'Unknown Session' });\n  } else {\n    interceptor.abort();\n  }\n});\n```\n\n#### Interceptor\n\n_Extends [Event](server/event)_\n\nThe `intercept` handler receives a third `interceptor` argument that provides\nsome utilities.\n\n##### abort\n\nCalling the `abort` method on the interceptor tells the Polly instance to\ncontinue handling the request as if it hasn't been intercepted. This allows you\nto only intercept specific types of requests while opting out of others.\n\n**Example**\n\n```js\nserver.get('/session/:id').intercept((req, res, interceptor) => {\n  if (req.params.id === '1') {\n    res.status(200).json({ token: 'ABC123XYZ' });\n  } else {\n    interceptor.abort();\n  }\n});\n```\n\n##### passthrough\n\nCalling the `passthrough` method on the interceptor tells the Polly instance to\ncontinue handling the request as if it has been declared as a passthrough.\nThis allows you to only intercept specific types of requests while passing\nothers through.\n\n**Example**\n\n```js\nserver.get('/session/:id').intercept((req, res, interceptor) => {\n  if (req.params.id === '1') {\n    res.status(200).json({ token: 'ABC123XYZ' });\n  } else {\n    interceptor.passthrough();\n  }\n});\n```\n\n##### stopPropagation\n\nIf 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.\n\n**Example**\n\n```js\n// First call should return the user and not enter the 2nd handler\nserver\n  .get('/session/:id')\n  .times(1) // Remove this interceptor after it gets called once\n  .intercept((req, res, interceptor) => {\n    // Do not continue to the next intercept handler which handles the 404 case\n    interceptor.stopPropagation();\n    res.sendStatus(200);\n  });\n\nserver.delete('/session/:id').intercept((req, res) => res.sendStatus(204));\n\n// Second call should 404 since the user no longer exists\nserver.get('/session/:id').intercept((req, res) => res.sendStatus(404));\n\nawait fetch('/session/1'); // --> 200\nawait fetch('/session/1', { method: 'DELETE' }); // --> 204\nawait fetch('/session/1'); // --> 404\n```\n\n### passthrough\n\nDeclare a route as a passthrough meaning any request that matches that route\nwill directly use the native implementation. Passthrough requests will not be\nrecorded.\n\n| Param       | Type      | Description                                           |\n| ----------- | --------- | ----------------------------------------------------- |\n| passthrough | `boolean` | Enable or disable the passthrough. Defaults to `true` |\n\n**Example**\n\n```js\nserver.any('/session').passthrough();\n\nserver.get('/session/1').passthrough(false);\n```\n\n### filter\n\nFilter requests matched by the route handler with a predicate callback function.\nThis can be useful when trying to match a request by a part of the url, a header,\nand/or parts of the request body.\n\nThe callback will receive the [Request](server/request)\nas an argument. Return `true` to match the request, `false` otherwise.\n\n?> Multiple filters can be chained together. They must all return `true` for the route handler to match the given request.\n\n| Param    | Type       | Description                   |\n| -------- | ---------- | ----------------------------- |\n| callback | `Function` | The filter predicate function |\n\n**Example**\n\n```js\nserver\n  .any()\n  .filter(req => req.hasHeader('Authentication'));\n  .on('request', req => {\n    res.setHeader('Authentication', 'test123')\n  });\n\nserver\n  .get('/users/:id')\n  .filter(req => req.params.id === '1');\n  .intercept((req, res) => {\n    res.status(200).json({ email: 'user1@test.com' });\n  });\n```\n\n### times\n\nProceeding 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.\n\n| Param | Type     | Description                                                                                        |\n| ----- | -------- | -------------------------------------------------------------------------------------------------- |\n| times | `number` | Default times value for proceeding handlers. If no value is provided, the default value is removed |\n\n**Example**\n\n```js\nserver\n  .any()\n  .times(2);\n  .on('request', req => {});\n  .intercept((req, res) => {});\n  .times()\n  .on('response', (req, res) => {});\n\n// Is the same as:\n\nserver\n  .any()\n  .on('request', req => {}, { times: 2 });\n  .intercept((req, res) => {}, { times: 2 });\n  .on('response', (req, res) => {});\n```\n\n### configure\n\nOverride configuration options for the given route. All matching middleware and route level configs are merged together and the overrides are applied to the current\nPolly instance's config.\n\n!> The following options are not supported to be overridden via the server API:\n`mode`, `adapters`, `adapterOptions`, `persister`, `persisterOptions`\n\n| Param  | Type     | Description                           |\n| ------ | -------- | ------------------------------------- |\n| config | `Object` | [Configuration](configuration) object |\n\n**Example**\n\n```js\nserver.any('/session').configure({ recordFailedRequests: true });\n\nserver.get('/users/:id').configure({ timing: Timing.relative(3.0) });\n\nserver.get('/users/1').configure({ logLevel: 'info' });\n```\n\n### recordingName\n\nOverride the recording name for the given route. This allows for grouping common\nrequests to share a single recording which can drastically help de-clutter test\nrecordings.\n\nFor example, if your tests always make a `/users` or `/session` call, instead of\nhaving each of those requests be recorded for every single test, you can use\nthis to create a common recording file for them.\n\n| Param         | Type     | Description                                                               |\n| ------------- | -------- | ------------------------------------------------------------------------- |\n| recordingName | `String` | Name of the [recording](api#recordingName) to store the recordings under. |\n\n**Example**\n\n```js\nserver.any('/session').recordingName('User Session');\n\nserver.get('/users/:id').recordingName('User Data');\n\nserver\n  .get('/users/1')\n  .recordingName(); /* Fallback to the polly instance's recording name */\n```\n"
  },
  {
    "path": "docs/test-frameworks/jest-jasmine.md",
    "content": "# Jest & Jasmine\n\nDue to the nature of the Jest & Jasmine APIs and their restrictions on accessing\nthe current running test and its parent modules, we've decided to keep this test helper\nas a 3rd party library provided by [@gribnoysup](https://github.com/gribnoysup).\n\nThe [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.\nThe Polly instance's recording name is derived from the current test name as well as its\nparent module(s).\n\n[README.md](https://raw.githubusercontent.com/gribnoysup/setup-polly-jest/master/README.md ':include :type=markdown')\n"
  },
  {
    "path": "docs/test-frameworks/mocha.md",
    "content": "# Mocha\n\nThe `@pollyjs/core` package provides a `setupMocha` utility which will setup\na new polly instance for each test as well as stop it once the test has ended.\nThe Polly instance's recording name is derived from the current test name as well as its\nparent module(s).\n\n| Param  | Type     | Description                           |\n| ------ | -------- | ------------------------------------- |\n| config | `Object` | [Configuration](configuration) object |\n\n## Usage\n\n### Simple Example {docsify-ignore}\n\n```js\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\ndescribe('Netflix Homepage', function() {\n  setupPolly({\n    /* default configuration options */\n  });\n\n  it('should be able to sign in', async function() {\n    /*\n      The setupPolly test helper creates a new polly instance which you can\n      access via `this.polly`. The recording name is generated based on the module\n      and test names.\n    */\n    this.polly.configure({ recordIfMissing: false });\n\n    /* start: pseudo test code */\n    await visit('/login');\n    await fillIn('email', 'polly@netflix.com');\n    await fillIn('password', '@pollyjs');\n    await submit();\n    /* end: pseudo test code */\n\n    expect(location.pathname).to.equal('/browse');\n\n    /*\n      The setupPolly test helper will call `this.polly.stop()` when your test\n      has finished.\n    */\n  });\n});\n```\n\n### Intercept Example {docsify-ignore}\n\n```js\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\ndescribe('module', function() {\n  setupPolly();\n\n  it('does a thing', function() {\n    const { server } = this.polly;\n\n    server\n      .get('/ping')\n      .intercept((req, res) => res.sendStatus(200));\n\n    expect((await fetch('/ping').status).to.equal(200);\n  });\n});\n```\n\n## Test Hook Ordering\n\nAccessing `this.polly` during a test run after the polly instance has been\nstopped and destroyed produces the following error:\n\n!> _You are trying to access an instance of Polly that is no longer available._\n\nIf 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`.\n\nInstead of calling `setupMocha()`, register these two hooks separately in the order that fits within your test.\n\n```js\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\ndescribe('Netflix Homepage', function() {\n  setupPolly.beforeEach({\n    /* default configuration options */\n  });\n\n  afterEach(function() {\n    /* do something before the polly instance is destroyed... */\n  });\n\n  setupPolly.afterEach();\n\n  it('should be able to sign in', async function() {\n    /* ... */\n  });\n});\n```\n\n## Configuring ember-mocha\n\nIf you're using [`ember-mocha`](https://github.com/emberjs/ember-mocha) be sure to use their built-in\n[hooks API](https://github.com/emberjs/ember-mocha#setup-tests).  Otherwise, Polly's mocha test helper will be unable to teardown Polly between tests.\n\nAn example of how to correctly setup Polly with `ember-mocha`:\n\n```js\nimport { expect } from 'chai';\nimport { describe, it } from 'mocha';\nimport { setupApplicationTest } from 'ember-mocha';\nimport { visit, currentURL } from '@ember/test-helpers';\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\ndescribe('Acceptance | Home', function() {\n  const hooks = setupApplicationTest();\n  setupPolly(\n    {\n      /* optional config */\n    },\n    hooks\n  );\n\n  it('can visit /', async function() {\n    await visit('/');\n    expect(currentURL()).to.equal('/');\n  });\n});\n```\n"
  },
  {
    "path": "docs/test-frameworks/qunit.md",
    "content": "# QUnit\n\nThe `@pollyjs/core` package provides a `setupQunit` utility which will setup\na new polly instance for each test as well as stop it once the test has ended.\nThe Polly instance's recording name is derived from the current test name as well as its\nparent module(s).\n\n| Param  | Type     | Description                           |\n| ------ | -------- | ------------------------------------- |\n| hooks  | `Object` | QUnit hooks object                    |\n| config | `Object` | [Configuration](configuration) object |\n\n## Usage\n\n### Simple Example {docsify-ignore}\n\n```js\nimport { setupQunit as setupPolly } from '@pollyjs/core';\n\nmodule('Netflix Homepage', function(hooks) {\n  setupPolly(hooks, {\n    /* default configuration options */\n  });\n\n  test('should be able to sign in', async function(assert) {\n    /*\n      The setupPolly test helper creates a new polly instance which you can\n      access via `this.polly`. The recording name is generated based on the module\n      and test names.\n    */\n    this.polly.configure({ recordIfMissing: false });\n\n    /* start: pseudo test code */\n    await visit('/login');\n    await fillIn('email', 'polly@netflix.com');\n    await fillIn('password', '@pollyjs');\n    await submit();\n    /* end: pseudo test code */\n\n    assert.equal(location.pathname, '/browse');\n\n    /*\n      The setupPolly test helper will call `this.polly.stop()` when your test\n      has finished.\n    */\n  });\n});\n```\n\n### Intercept Example {docsify-ignore}\n\n```js\nimport { setupQunit as setupPolly } from '@pollyjs/core';\n\nmodule('module', function(hooks) {\n  setupPolly(hooks);\n\n  test('does a thing', function(assert) {\n    const { server } = this.polly;\n\n    server\n      .get('/ping')\n      .intercept((req, res) => res.sendStatus(200));\n\n    assert.equal((await fetch('/ping').status, 200);\n  });\n});\n```\n\n## Test Hook Ordering\n\nAccessing `this.polly` during a test run after the polly instance has been\nstopped and destroyed produces the following error:\n\n!> _You are trying to access an instance of Polly that is no longer available._\n\nIf 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`.\n\nInstead of calling `setupQunit()`, register these two hooks separately in the order that fits within your test.\n\n```js\nimport { setupQunit as setupPolly } from '@pollyjs/core';\n\nmodule('Netflix Homepage', function(hooks) {\n  setupPolly.beforeEach(hooks, {\n    /* default configuration options */\n  });\n\n  hooks.afterEach(function() {\n    /* do something before the polly instance is destroyed... */\n  });\n\n  setupPolly.afterEach(hooks);\n\n  test('should be able to sign in', async function() {\n    /* ... */\n  });\n});\n```\n"
  },
  {
    "path": "examples/.eslintrc.js",
    "content": "module.exports = {\n  env: {\n    node: true,\n    browser: true\n  }\n};\n"
  },
  {
    "path": "examples/client-server/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <title>Client Server Tests</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <link\n      rel=\"stylesheet\"\n      type=\"text/css\"\n      href=\"./node_modules/mocha/mocha.css\"\n    />\n  </head>\n  <body>\n    <div id=\"mocha\"></div>\n\n    <script src=\"./node_modules/mocha/mocha.js\"></script>\n    <script src=\"./node_modules/chai/chai.js\"></script>\n    <script src=\"./node_modules/@pollyjs/core/dist/umd/pollyjs-core.js\"></script>\n    <script src=\"./node_modules/@pollyjs/adapter-fetch/dist/umd/pollyjs-adapter-fetch.js\"></script>\n    <script src=\"./node_modules/@pollyjs/persister-local-storage/dist/umd/pollyjs-persister-local-storage.js\"></script>\n\n    <script src=\"./tests/setup.js\"></script>\n    <script src=\"./tests/intercept.test.js\"></script>\n    <script src=\"./tests/events.test.js\"></script>\n\n    <script>\n      mocha.checkLeaks();\n      mocha.run();\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/client-server/package.json",
    "content": "{\n  \"name\": \"@pollyjs/client-server-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"test\": \"http-server -p 3000 -o -c-1 -s\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-fetch\": \"*\",\n    \"@pollyjs/core\": \"*\",\n    \"@pollyjs/persister-local-storage\": \"*\",\n    \"chai\": \"*\",\n    \"http-server\": \"*\",\n    \"mocha\": \"*\"\n  }\n}\n"
  },
  {
    "path": "examples/client-server/tests/events.test.js",
    "content": "/* global setupPolly */\n\ndescribe('Events', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister: 'local-storage'\n  });\n\n  it('can help test dynamic data', async function () {\n    const { server } = this.polly;\n    let numPosts = 0;\n\n    server\n      .get('https://jsonplaceholder.typicode.com/posts')\n      .on('response', (_, res) => {\n        numPosts = res.jsonBody().length;\n      });\n\n    const res = await fetch('https://jsonplaceholder.typicode.com/posts');\n    const posts = await res.json();\n\n    expect(res.status).to.equal(200);\n    expect(posts.length).to.equal(numPosts);\n  });\n});\n"
  },
  {
    "path": "examples/client-server/tests/intercept.test.js",
    "content": "/* global setupPolly */\n\ndescribe('Intercept', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister: 'local-storage'\n  });\n\n  it('can mock valid responses', async function () {\n    const { server } = this.polly;\n\n    server\n      .get('https://jsonplaceholder.typicode.com/posts/:id')\n      .intercept((req, res) => {\n        res.status(200).json({\n          id: Number(req.params.id),\n          title: `Post ${req.params.id}`\n        });\n      });\n\n    const res = await fetch('https://jsonplaceholder.typicode.com/posts/42');\n    const post = await res.json();\n\n    expect(res.status).to.equal(200);\n    expect(post.id).to.equal(42);\n    expect(post.title).to.equal('Post 42');\n  });\n\n  it('can mock invalid responses', async function () {\n    const { server } = this.polly;\n\n    server\n      .get('https://jsonplaceholder.typicode.com/posts/404')\n      .intercept((_, res) => {\n        res.status(404).send('Post not found.');\n      });\n\n    const res = await fetch('https://jsonplaceholder.typicode.com/posts/404');\n    const text = await res.text();\n\n    expect(res.status).to.equal(404);\n    expect(text).to.equal('Post not found.');\n  });\n\n  it('can conditionally intercept requests', async function () {\n    const { server } = this.polly;\n\n    server\n      .get('https://jsonplaceholder.typicode.com/posts/:id')\n      .intercept((req, res, interceptor) => {\n        if (req.params.id === '42') {\n          res.status(200).send('Life');\n        } else {\n          // Abort out of the intercept handler and continue with the request\n          interceptor.abort();\n        }\n      });\n\n    let res = await fetch('https://jsonplaceholder.typicode.com/posts/42');\n\n    expect(res.status).to.equal(200);\n    expect(await res.text()).to.equal('Life');\n\n    res = await fetch('https://jsonplaceholder.typicode.com/posts/1');\n\n    expect(res.status).to.equal(200);\n    expect((await res.json()).id).to.equal(1);\n  });\n});\n"
  },
  {
    "path": "examples/client-server/tests/setup.js",
    "content": "// Expose common globals\nwindow.PollyJS = window['@pollyjs/core'];\nwindow.setupPolly = window.PollyJS.setupMocha;\nwindow.expect = window.chai.expect;\n\n// Register the fetch adapter and local-storage persister\nwindow.PollyJS.Polly.register(window['@pollyjs/adapter-fetch']);\nwindow.PollyJS.Polly.register(window['@pollyjs/persister-local-storage']);\n\n// Setup Mocha\nmocha.setup({ ui: 'bdd', noHighlighting: true });\n"
  },
  {
    "path": "examples/dummy-app/.eslintrc.js",
    "content": "module.exports = {\n  extends: ['plugin:react/recommended'],\n  settings: {\n    react: {\n      version: '16.5.1'\n    }\n  }\n};\n"
  },
  {
    "path": "examples/dummy-app/.gitignore",
    "content": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "examples/dummy-app/README.md",
    "content": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).\n\nBelow you will find some information on how to perform common tasks.<br>\nYou 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).\n\n## Table of Contents\n\n- [Updating to New Releases](#updating-to-new-releases)\n- [Sending Feedback](#sending-feedback)\n- [Folder Structure](#folder-structure)\n- [Available Scripts](#available-scripts)\n  - [npm start](#npm-start)\n  - [npm test](#npm-test)\n  - [npm run build](#npm-run-build)\n  - [npm run eject](#npm-run-eject)\n- [Supported Browsers](#supported-browsers)\n- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills)\n- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor)\n- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor)\n- [Debugging in the Editor](#debugging-in-the-editor)\n- [Formatting Code Automatically](#formatting-code-automatically)\n- [Changing the Page `<title>`](#changing-the-page-title)\n- [Installing a Dependency](#installing-a-dependency)\n- [Importing a Component](#importing-a-component)\n- [Code Splitting](#code-splitting)\n- [Adding a Stylesheet](#adding-a-stylesheet)\n- [Post-Processing CSS](#post-processing-css)\n- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc)\n- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files)\n- [Using the `public` Folder](#using-the-public-folder)\n  - [Changing the HTML](#changing-the-html)\n  - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system)\n  - [When to Use the `public` Folder](#when-to-use-the-public-folder)\n- [Using Global Variables](#using-global-variables)\n- [Adding Bootstrap](#adding-bootstrap)\n  - [Using a Custom Theme](#using-a-custom-theme)\n- [Adding Flow](#adding-flow)\n- [Adding a Router](#adding-a-router)\n- [Adding Custom Environment Variables](#adding-custom-environment-variables)\n  - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html)\n  - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell)\n  - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env)\n- [Can I Use Decorators?](#can-i-use-decorators)\n- [Fetching Data with AJAX Requests](#fetching-data-with-ajax-requests)\n- [Integrating with an API Backend](#integrating-with-an-api-backend)\n  - [Node](#node)\n  - [Ruby on Rails](#ruby-on-rails)\n- [Proxying API Requests in Development](#proxying-api-requests-in-development)\n  - [\"Invalid Host Header\" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy)\n  - [Configuring the Proxy Manually](#configuring-the-proxy-manually)\n  - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy)\n- [Using HTTPS in Development](#using-https-in-development)\n- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server)\n- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files)\n- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page)\n- [Running Tests](#running-tests)\n  - [Filename Conventions](#filename-conventions)\n  - [Command Line Interface](#command-line-interface)\n  - [Version Control Integration](#version-control-integration)\n  - [Writing Tests](#writing-tests)\n  - [Testing Components](#testing-components)\n  - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries)\n  - [Initializing Test Environment](#initializing-test-environment)\n  - [Focusing and Excluding Tests](#focusing-and-excluding-tests)\n  - [Coverage Reporting](#coverage-reporting)\n  - [Continuous Integration](#continuous-integration)\n  - [Disabling jsdom](#disabling-jsdom)\n  - [Snapshot Testing](#snapshot-testing)\n  - [Editor Integration](#editor-integration)\n- [Debugging Tests](#debugging-tests)\n  - [Debugging Tests in Chrome](#debugging-tests-in-chrome)\n  - [Debugging Tests in Visual Studio Code](#debugging-tests-in-visual-studio-code)\n- [Developing Components in Isolation](#developing-components-in-isolation)\n  - [Getting Started with Storybook](#getting-started-with-storybook)\n  - [Getting Started with Styleguidist](#getting-started-with-styleguidist)\n- [Publishing Components to npm](#publishing-components-to-npm)\n- [Making a Progressive Web App](#making-a-progressive-web-app)\n  - [Opting Out of Caching](#opting-out-of-caching)\n  - [Offline-First Considerations](#offline-first-considerations)\n  - [Progressive Web App Metadata](#progressive-web-app-metadata)\n- [Analyzing the Bundle Size](#analyzing-the-bundle-size)\n- [Deployment](#deployment)\n  - [Static Server](#static-server)\n  - [Other Solutions](#other-solutions)\n  - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)\n  - [Building for Relative Paths](#building-for-relative-paths)\n  - [Azure](#azure)\n  - [Firebase](#firebase)\n  - [GitHub Pages](#github-pages)\n  - [Heroku](#heroku)\n  - [Netlify](#netlify)\n  - [Now](#now)\n  - [S3 and CloudFront](#s3-and-cloudfront)\n  - [Surge](#surge)\n- [Advanced Configuration](#advanced-configuration)\n- [Troubleshooting](#troubleshooting)\n  - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes)\n  - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra)\n  - [`npm run build` exits too early](#npm-run-build-exits-too-early)\n  - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)\n  - [`npm run build` fails to minify](#npm-run-build-fails-to-minify)\n  - [Moment.js locales are missing](#momentjs-locales-are-missing)\n- [Alternatives to Ejecting](#alternatives-to-ejecting)\n- [Something Missing?](#something-missing)\n\n## Updating to New Releases\n\nCreate React App is divided into two packages:\n\n- `create-react-app` is a global command-line utility that you use to create new projects.\n- `react-scripts` is a development dependency in the generated projects (including this one).\n\nYou almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`.\n\nWhen 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.\n\nTo 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.\n\nIn 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.\n\nWe commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly.\n\n## Sending Feedback\n\nWe are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues).\n\n## Folder Structure\n\nAfter creation, your project should look like this:\n\n```\nmy-app/\n  README.md\n  node_modules/\n  package.json\n  public/\n    index.html\n    favicon.ico\n  src/\n    App.css\n    App.js\n    App.test.js\n    index.css\n    index.js\n    logo.svg\n```\n\nFor the project to build, **these files must exist with exact filenames**:\n\n- `public/index.html` is the page template;\n- `src/index.js` is the JavaScript entry point.\n\nYou can delete or rename the other files.\n\nYou may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br>\nYou need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them.\n\nOnly files inside `public` can be used from `public/index.html`.<br>\nRead instructions below for using assets from JavaScript and HTML.\n\nYou can, however, create more top-level directories.<br>\nThey will not be included in the production build so you can use them for things like documentation.\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.<br>\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.<br>\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.<br>\nSee the section about [running tests](#running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.<br>\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.<br>\nYour app is ready to be deployed!\n\nSee the section about [deployment](#deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf 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.\n\nInstead, 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.\n\nYou 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.\n\n## Supported Browsers\n\nBy default, the generated project uses the latest version of React.\n\nYou can refer [to the React documentation](https://reactjs.org/docs/react-dom.html#browser-support) for more information about supported browsers.\n\n## Supported Language Features and Polyfills\n\nThis project supports a superset of the latest JavaScript standard.<br>\nIn addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports:\n\n- [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016).\n- [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017).\n- [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal).\n- [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal)\n- [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (part of stage 3 proposal).\n- [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax.\n\nLearn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-).\n\nWhile 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.\n\nNote that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**:\n\n- [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign).\n- [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise).\n- [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch).\n\nIf 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.\n\nAlso 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.\n\n## Syntax Highlighting in the Editor\n\nTo 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.\n\n## Displaying Lint Output in the Editor\n\n> Note: this feature is available with `react-scripts@0.2.0` and higher.<br>\n> It also only works with npm 3 or higher.\n\nSome editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.\n\nThey 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.\n\nYou would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root:\n\n```js\n{\n  \"extends\": \"react-app\"\n}\n```\n\nNow your editor should report the linting warnings.\n\nNote 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.\n\nIf you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules.\n\n## Debugging in the Editor\n\n**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).**\n\nVisual 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.\n\n### Visual Studio Code\n\nYou 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.\n\nThen add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory.\n\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Chrome\",\n      \"type\": \"chrome\",\n      \"request\": \"launch\",\n      \"url\": \"http://localhost:3000\",\n      \"webRoot\": \"${workspaceRoot}/src\",\n      \"sourceMapPathOverrides\": {\n        \"webpack:///src/*\": \"${webRoot}/*\"\n      }\n    }\n  ]\n}\n```\n\n> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart 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.\n\nHaving problems with VS Code Debugging? Please see their [troubleshooting guide](https://github.com/Microsoft/vscode-chrome-debug/blob/master/README.md#troubleshooting).\n\n### WebStorm\n\nYou 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.\n\nIn 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.\n\n> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration).\n\nStart 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.\n\nThe same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine.\n\n## Formatting Code Automatically\n\nPrettier 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/).\n\nTo format our code whenever we make a commit in git, we need to install the following dependencies:\n\n```sh\nnpm install --save husky lint-staged prettier\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add husky lint-staged prettier\n```\n\n- `husky` makes it easy to use githooks as if they are npm scripts.\n- `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).\n- `prettier` is the JavaScript formatter we will run before commits.\n\nNow we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root.\n\nAdd the following line to `scripts` section:\n\n```diff\n  \"scripts\": {\n+   \"precommit\": \"lint-staged\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nNext we add a 'lint-staged' field to the `package.json`, for example:\n\n```diff\n  \"dependencies\": {\n    // ...\n  },\n+ \"lint-staged\": {\n+   \"src/**/*.{js,jsx,json,css}\": [\n+     \"prettier --single-quote --write\",\n+     \"git add\"\n+   ]\n+ },\n  \"scripts\": {\n```\n\nNow, 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.\n\nNext 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.\n\n## Changing the Page `<title>`\n\nYou 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.\n\nNote 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.\n\nIf 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.\n\nIf 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).\n\n## Installing a Dependency\n\nThe 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`:\n\n```sh\nnpm install --save react-router\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router\n```\n\nThis works for any library, not just `react-router`.\n\n## Importing a Component\n\nThis project setup supports ES6 modules thanks to Babel.<br>\nWhile you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.\n\nFor example:\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass Button extends Component {\n  render() {\n    // ...\n  }\n}\n\nexport default Button; // Don’t forget to use export default!\n```\n\n### `DangerButton.js`\n\n```js\nimport React, { Component } from 'react';\nimport Button from './Button'; // Import a component from another file\n\nclass DangerButton extends Component {\n  render() {\n    return <Button color=\"red\" />;\n  }\n}\n\nexport default DangerButton;\n```\n\nBe 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.\n\nWe 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'`.\n\nNamed 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.\n\nLearn more about ES6 modules:\n\n- [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)\n- [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html)\n- [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules)\n\n## Code Splitting\n\nInstead 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.\n\nThis 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.\n\nHere is an example:\n\n### `moduleA.js`\n\n```js\nconst moduleA = 'Hello';\n\nexport { moduleA };\n```\n\n### `App.js`\n\n```js\nimport React, { Component } from 'react';\n\nclass App extends Component {\n  handleClick = () => {\n    import('./moduleA')\n      .then(({ moduleA }) => {\n        // Use moduleA\n      })\n      .catch(err => {\n        // Handle failure\n      });\n  };\n\n  render() {\n    return (\n      <div>\n        <button onClick={this.handleClick}>Load</button>\n      </div>\n    );\n  }\n}\n\nexport default App;\n```\n\nThis will make `moduleA.js` and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button.\n\nYou can also use it with `async` / `await` syntax if you prefer it.\n\n### With React Router\n\nIf you are using React Router check out [this tutorial](http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app).\n\nAlso check out the [Code Splitting](https://reactjs.org/docs/code-splitting.html) section in React documentation.\n\n## Adding a Stylesheet\n\nThis project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:\n\n### `Button.css`\n\n```css\n.Button {\n  padding: 20px;\n}\n```\n\n### `Button.js`\n\n```js\nimport React, { Component } from 'react';\nimport './Button.css'; // Tell Webpack that Button.js uses these styles\n\nclass Button extends Component {\n  render() {\n    // You can use them as regular CSS styles\n    return <div className=\"Button\" />;\n  }\n}\n```\n\n**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-blog/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.\n\nIn development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.\n\nIf you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.\n\n## Post-Processing CSS\n\nThis project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it.\n\nFor example, this:\n\n```css\n.App {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n}\n```\n\nbecomes this:\n\n```css\n.App {\n  display: -webkit-box;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-orient: horizontal;\n  -webkit-box-direction: normal;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  align-items: center;\n}\n```\n\nIf you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling).\n\n## Adding a CSS Preprocessor (Sass, Less etc.)\n\nGenerally, we recommend that you don’t reuse the same CSS classes across different components. For example, instead of using a `.Button` CSS class in `<AcceptButton>` and `<RejectButton>` components, we recommend creating a `<Button>` component with its own `.Button` styles, that both `<AcceptButton>` and `<RejectButton>` can render (but [not inherit](https://facebook.github.io/react/docs/composition-vs-inheritance.html)).\n\nFollowing this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable. In this walkthrough, we will be using Sass, but you can also use Less, or another alternative.\n\nFirst, let’s install the command-line interface for Sass:\n\n```sh\nnpm install --save node-sass-chokidar\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add node-sass-chokidar\n```\n\nThen in `package.json`, add the following lines to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"build-css\": \"node-sass-chokidar src/ -o src/\",\n+    \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\n> Note: To use a different preprocessor, replace `build-css` and `watch-css` commands according to your preprocessor’s documentation.\n\nNow you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`. The watcher will find every Sass file in `src` subdirectories, and create a corresponding CSS file next to it, in our case overwriting `src/App.css`. Since `src/App.js` still imports `src/App.css`, the styles become a part of your application. You can now edit `src/App.scss`, and `src/App.css` will be regenerated.\n\nTo share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import \"./shared.scss\";` with variable definitions.\n\nTo enable importing files without using relative paths, you can add the `--include-path` option to the command in `package.json`.\n\n```\n\"build-css\": \"node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/\",\n\"watch-css\": \"npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive\",\n```\n\nThis will allow you to do imports like\n\n```scss\n@import 'styles/_colors.scss'; // assuming a styles directory under src/\n@import 'nprogress/nprogress'; // importing a css file from the nprogress node module\n```\n\nAt this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control.\n\nAs a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this:\n\n```sh\nnpm install --save npm-run-all\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add npm-run-all\n```\n\nThen we can change `start` and `build` scripts to include the CSS preprocessor commands:\n\n```diff\n   \"scripts\": {\n     \"build-css\": \"node-sass-chokidar src/ -o src/\",\n     \"watch-css\": \"npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive\",\n-    \"start\": \"react-scripts start\",\n-    \"build\": \"react-scripts build\",\n+    \"start-js\": \"react-scripts start\",\n+    \"start\": \"npm-run-all -p watch-css start-js\",\n+    \"build-js\": \"react-scripts build\",\n+    \"build\": \"npm-run-all build-css build-js\",\n     \"test\": \"react-scripts test --env=jsdom\",\n     \"eject\": \"react-scripts eject\"\n   }\n```\n\nNow running `npm start` and `npm run build` also builds Sass files.\n\n**Why `node-sass-chokidar`?**\n\n`node-sass` has been reported as having the following issues:\n\n- `node-sass --watch` has been reported to have _performance issues_ in certain conditions when used in a virtual machine or with docker.\n\n- Infinite styles compiling [#1939](https://github.com/facebookincubator/create-react-app/issues/1939)\n\n- `node-sass` has been reported as having issues with detecting new files in a directory [#1891](https://github.com/sass/node-sass/issues/1891)\n\n`node-sass-chokidar` is used here as it addresses these issues.\n\n## Adding Images, Fonts, and Files\n\nWith Webpack, using static assets like images and fonts works similarly to CSS.\n\nYou can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.\n\nTo reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebookincubator/create-react-app/issues/1153).\n\nHere is an example:\n\n```js\nimport React from 'react';\nimport logo from './logo.png'; // Tell Webpack this JS file uses this image\n\nconsole.log(logo); // /logo.84287d09.png\n\nfunction Header() {\n  // Import result is the URL of your image\n  return <img src={logo} alt=\"Logo\" />;\n}\n\nexport default Header;\n```\n\nThis ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths.\n\nThis works in CSS too:\n\n```css\n.Logo {\n  background-image: url(./logo.png);\n}\n```\n\nWebpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.\n\nPlease be advised that this is also a custom feature of Webpack.\n\n**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br>\nAn alternative way of handling static assets is described in the next section.\n\n## Using the `public` Folder\n\n> Note: this feature is available with `react-scripts@0.5.0` and higher.\n\n### Changing the HTML\n\nThe `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title).\nThe `<script>` tag with the compiled code will be added to it automatically during the build process.\n\n### Adding Assets Outside of the Module System\n\nYou can also add other assets to the `public` folder.\n\nNote that we normally encourage you to `import` assets in JavaScript files instead.\nFor example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files).\nThis mechanism provides a number of benefits:\n\n- Scripts and stylesheets get minified and bundled together to avoid extra network requests.\n- Missing files cause compilation errors instead of 404 errors for your users.\n- Result filenames include content hashes so you don’t need to worry about browsers caching their old versions.\n\nHowever there is an **escape hatch** that you can use to add an asset outside of the module system.\n\nIf you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`.\n\nInside `index.html`, you can use it like this:\n\n```html\n<link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\" />\n```\n\nOnly files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.\n\nWhen you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.\n\nIn JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:\n\n```js\nrender() {\n  // Note: this is an escape hatch and should be used sparingly!\n  // Normally we recommend using `import` for getting asset URLs\n  // as described in “Adding Images and Fonts” above this section.\n  return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />;\n}\n```\n\nKeep in mind the downsides of this approach:\n\n- None of the files in `public` folder get post-processed or minified.\n- Missing files will not be called at compilation time, and will cause 404 errors for your users.\n- Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change.\n\n### When to Use the `public` Folder\n\nNormally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript.\nThe `public` folder is useful as a workaround for a number of less common cases:\n\n- You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).\n- You have thousands of images and need to dynamically reference their paths.\n- You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.\n- Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag.\n\nNote that if you add a `<script>` that declares global variables, you also need to read the next section on using them.\n\n## Using Global Variables\n\nWhen you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.\n\nYou can avoid this by reading the global variable explicitly from the `window` object, for example:\n\n```js\nconst $ = window.$;\n```\n\nThis makes it obvious you are using a global variable intentionally rather than because of a typo.\n\nAlternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it.\n\n## Adding Bootstrap\n\nYou don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps:\n\nInstall React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well:\n\n```sh\nnpm install --save react-bootstrap bootstrap@3\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-bootstrap bootstrap@3\n```\n\nImport Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your `src/index.js` file:\n\n```js\nimport 'bootstrap/dist/css/bootstrap.css';\nimport 'bootstrap/dist/css/bootstrap-theme.css';\n// Put any other imports below so that CSS from your\n// components takes precedence over default styles.\n```\n\nImport required React Bootstrap components within `src/App.js` file or your custom component files:\n\n```js\nimport { Navbar, Jumbotron, Button } from 'react-bootstrap';\n```\n\nNow you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap.\n\n### Using a Custom Theme\n\nSometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br>\nWe suggest the following approach:\n\n- Create a new package that depends on the package you wish to customize, e.g. Bootstrap.\n- Add the necessary build steps to tweak the theme, and publish your package on npm.\n- Install your own theme npm package as a dependency of your app.\n\nHere is an example of adding a [customized Bootstrap](https://medium.com/@tacomanator/customizing-create-react-app-aa9ffb88165) that follows these steps.\n\n## Adding Flow\n\nFlow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.\n\nRecent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box.\n\nTo add Flow to a Create React App project, follow these steps:\n\n1. Run `npm install --save flow-bin` (or `yarn add flow-bin`).\n2. Add `\"flow\": \"flow\"` to the `scripts` section of your `package.json`.\n3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory.\n4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).\n\nNow you can run `npm run flow` (or `yarn flow`) to check the files for type errors.\nYou can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.\nIn the future we plan to integrate it into Create React App even more closely.\n\nTo learn more about Flow, check out [its documentation](https://flowtype.org/).\n\n## Adding a Router\n\nCreate React App doesn't prescribe a specific routing solution, but [React Router](https://reacttraining.com/react-router/) is the most popular one.\n\nTo add it, run:\n\n```sh\nnpm install --save react-router-dom\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-router-dom\n```\n\nTo try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started.\n\nNote that [you may need to configure your production server to support client-side routing](#serving-apps-with-client-side-routing) before deploying your app.\n\n## Adding Custom Environment Variables\n\n> Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nYour project can consume variables declared in your environment as if they were declared locally in your JS files. By\ndefault you will have `NODE_ENV` defined for you, and any other environment variables starting with\n`REACT_APP_`.\n\n**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them.\n\n> Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\nThese environment variables will be defined for you on `process.env`. For example, having an environment\nvariable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`.\n\nThere is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production.\n\nThese environment variables can be useful for displaying information conditionally based on where the project is\ndeployed or consuming sensitive data that lives outside of version control.\n\nFirst, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined\nin the environment inside a `<form>`:\n\n```jsx\nrender() {\n  return (\n    <div>\n      <small>You are running this application in <b>{process.env.NODE_ENV}</b> mode.</small>\n      <form>\n        <input type=\"hidden\" defaultValue={process.env.REACT_APP_SECRET_CODE} />\n      </form>\n    </div>\n  );\n}\n```\n\nDuring the build, `process.env.REACT_APP_SECRET_CODE` will be replaced with the current value of the `REACT_APP_SECRET_CODE` environment variable. Remember that the `NODE_ENV` variable will be set for you automatically.\n\nWhen you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`:\n\n```html\n<div>\n  <small>You are running this application in <b>development</b> mode.</small>\n  <form><input type=\"hidden\" value=\"abcdef\" /></form>\n</div>\n```\n\nThe above form is looking for a variable called `REACT_APP_SECRET_CODE` from the environment. In order to consume this\nvalue, we need to have it defined in the environment. This can be done using two ways: either in your shell or in\na `.env` file. Both of these ways are described in the next few sections.\n\nHaving access to the `NODE_ENV` is also useful for performing actions conditionally:\n\n```js\nif (process.env.NODE_ENV !== 'production') {\n  analytics.disable();\n}\n```\n\nWhen you compile the app with `npm run build`, the minification step will strip out this condition, and the resulting bundle will be smaller.\n\n### Referencing Environment Variables in the HTML\n\n> Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nYou can also access the environment variables starting with `REACT_APP_` in the `public/index.html`. For example:\n\n```html\n<title>%REACT_APP_WEBSITE_NAME%</title>\n```\n\nNote that the caveats from the above section apply:\n\n- Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work.\n- The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](#generating-dynamic-meta-tags-on-the-server).\n\n### Adding Temporary Environment Variables In Your Shell\n\nDefining environment variables can vary between OSes. It’s also important to know that this manner is temporary for the\nlife of the shell session.\n\n#### Windows (cmd.exe)\n\n```cmd\nset \"REACT_APP_SECRET_CODE=abcdef\" && npm start\n```\n\n(Note: Quotes around the variable assignment are required to avoid a trailing whitespace.)\n\n#### Windows (Powershell)\n\n```Powershell\n($env:REACT_APP_SECRET_CODE = \"abcdef\") -and (npm start)\n```\n\n#### Linux, macOS (Bash)\n\n```bash\nREACT_APP_SECRET_CODE=abcdef npm start\n```\n\n### Adding Development Environment Variables In `.env`\n\n> Note: this feature is available with `react-scripts@0.5.0` and higher.\n\nTo define permanent environment variables, create a file called `.env` in the root of your project:\n\n```\nREACT_APP_SECRET_CODE=abcdef\n```\n\n> Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid [accidentally exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running.\n\n`.env` files **should be** checked into source control (with the exclusion of `.env*.local`).\n\n#### What other `.env` files can be used?\n\n> Note: this feature is **available with `react-scripts@1.0.0` and higher**.\n\n- `.env`: Default.\n- `.env.local`: Local overrides. **This file is loaded for all environments except test.**\n- `.env.development`, `.env.test`, `.env.production`: Environment-specific settings.\n- `.env.development.local`, `.env.test.local`, `.env.production.local`: Local overrides of environment-specific settings.\n\nFiles on the left have more priority than files on the right:\n\n- `npm start`: `.env.development.local`, `.env.development`, `.env.local`, `.env`\n- `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env`\n- `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing)\n\nThese variables will act as the defaults if the machine does not explicitly set them.<br>\nPlease refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.\n\n> Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need\n> these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).\n\n#### Expanding Environment Variables In `.env`\n\n> Note: this feature is available with `react-scripts@1.1.0` and higher.\n\nExpand variables already on your machine for use in your `.env` file (using [dotenv-expand](https://github.com/motdotla/dotenv-expand)).\n\nFor example, to get the environment variable `npm_package_version`:\n\n```\nREACT_APP_VERSION=$npm_package_version\n# also works:\n# REACT_APP_VERSION=${npm_package_version}\n```\n\nOr expand variables local to the current `.env` file:\n\n```\nDOMAIN=www.example.com\nREACT_APP_FOO=$DOMAIN/foo\nREACT_APP_BAR=$DOMAIN/bar\n```\n\n## Can I Use Decorators?\n\nMany popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.<br>\nCreate React App doesn’t support decorator syntax at the moment because:\n\n- It is an experimental proposal and is subject to change.\n- The current specification version is not officially supported by Babel.\n- If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.\n\nHowever in many cases you can rewrite decorator-based code without decorators just as fine.<br>\nPlease refer to these two threads for reference:\n\n- [#214](https://github.com/facebookincubator/create-react-app/issues/214)\n- [#411](https://github.com/facebookincubator/create-react-app/issues/411)\n\nCreate React App will add decorator support when the specification advances to a stable stage.\n\n## Fetching Data with AJAX Requests\n\nReact doesn't prescribe a specific approach to data fetching, but people commonly use either a library like [axios](https://github.com/axios/axios) or the [`fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) provided by the browser. Conveniently, Create React App includes a polyfill for `fetch()` so you can use it without worrying about the browser support.\n\nThe global `fetch` function allows to easily makes AJAX requests. It takes in a URL as an input and returns a `Promise` that resolves to a `Response` object. You can find more information about `fetch` [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).\n\nThis project also includes a [Promise polyfill](https://github.com/then/promise) which provides a full implementation of Promises/A+. A Promise represents the eventual result of an asynchronous operation, you can find more information about Promises [here](https://www.promisejs.org/) and [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Both axios and `fetch()` use Promises under the hood. You can also use the [`async / await`](https://davidwalsh.name/async-await) syntax to reduce the callback nesting.\n\nYou can learn more about making AJAX requests from React components in [the FAQ entry on the React website](https://reactjs.org/docs/faq-ajax.html).\n\n## Integrating with an API Backend\n\nThese tutorials will help you to integrate your app with an API backend running on another port,\nusing `fetch()` to access it.\n\n### Node\n\nCheck out [this tutorial](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo).\n\n### Ruby on Rails\n\nCheck out [this tutorial](https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/).\nYou can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo-rails).\n\n## Proxying API Requests in Development\n\n> Note: this feature is available with `react-scripts@0.2.3` and higher.\n\nPeople often serve the front-end React app from the same host and port as their backend implementation.<br>\nFor example, a production setup might look like this after the app is deployed:\n\n```\n/             - static server returns index.html with React app\n/todos        - static server returns index.html with React app\n/api/todos    - server handles any /api/* requests using the backend implementation\n```\n\nSuch setup is **not** required. However, if you **do** have a setup like this, it is convenient to write requests like `fetch('/api/todos')` without worrying about redirecting them to another host or port during development.\n\nTo tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `package.json`, for example:\n\n```js\n  \"proxy\": \"http://localhost:4000\",\n```\n\nThis way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:4000/api/todos` as a fallback. The development server will **only** attempt to send requests without `text/html` in its `Accept` header to the proxy.\n\nConveniently, this avoids [CORS issues](http://stackoverflow.com/questions/21854516/understanding-ajax-cors-and-security-considerations) and error messages like this in development:\n\n```\nFetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.\n```\n\nKeep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.\n\nThe `proxy` option supports HTTP, HTTPS and WebSocket connections.<br>\nIf the `proxy` option is **not** flexible enough for you, alternatively you can:\n\n- [Configure the proxy yourself](#configuring-the-proxy-manually)\n- Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).\n- Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app.\n\n### \"Invalid Host Header\" Errors After Configuring Proxy\n\nWhen you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. The issue is explained in [this article](https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a) and [this issue](https://github.com/webpack/webpack-dev-server/issues/887).\n\nThis shouldn’t affect you when developing on `localhost`, but if you develop remotely like [described here](https://github.com/facebookincubator/create-react-app/issues/2271), you will see this error in the browser after enabling the `proxy` option:\n\n> Invalid Host header\n\nTo work around it, you can specify your public development host in a file called `.env.development` in the root of your project:\n\n```\nHOST=mypublicdevhost.com\n```\n\nIf you restart the development server now and load the app from the specified host, it should work.\n\nIf you are still having issues or if you’re using a more exotic environment like a cloud editor, you can bypass the host check completely by adding a line to `.env.development.local`. **Note that this is dangerous and exposes your machine to remote code execution from malicious websites:**\n\n```\n# NOTE: THIS IS DANGEROUS!\n# It exposes your machine to attacks from the websites you visit.\nDANGEROUSLY_DISABLE_HOST_CHECK=true\n```\n\nWe don’t recommend this approach.\n\n### Configuring the Proxy Manually\n\n> Note: this feature is available with `react-scripts@1.0.0` and higher.\n\nIf the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).<br>\nYou may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports.\n\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/api\": {\n      \"target\": \"<url>\",\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\nAll requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy.\n\nIf you need to specify multiple proxies, you may do so by specifying additional entries.\nMatches are regular expressions, so that you can use a regexp to match multiple paths.\n\n```js\n{\n  // ...\n  \"proxy\": {\n    // Matches any request starting with /api\n    \"/api\": {\n      \"target\": \"<url_1>\",\n      \"ws\": true\n      // ...\n    },\n    // Matches any request starting with /foo\n    \"/foo\": {\n      \"target\": \"<url_2>\",\n      \"ssl\": true,\n      \"pathRewrite\": {\n        \"^/foo\": \"/foo/beta\"\n      }\n      // ...\n    },\n    // Matches /bar/abc.html but not /bar/sub/def.html\n    \"/bar/[^/]*[.]html\": {\n      \"target\": \"<url_3>\",\n      // ...\n    },\n    // Matches /baz/abc.html and /baz/sub/def.html\n    \"/baz/.*/.*[.]html\": {\n      \"target\": \"<url_4>\"\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n### Configuring a WebSocket Proxy\n\nWhen setting up a WebSocket proxy, there are a some extra considerations to be aware of.\n\nIf you’re using a WebSocket engine like [Socket.io](https://socket.io/), you must have a Socket.io server running that you can use as the proxy target. Socket.io will not work with a standard WebSocket server. Specifically, don't expect Socket.io to work with [the websocket.org echo test](http://websocket.org/echo.html).\n\nThere’s some good documentation available for [setting up a Socket.io server](https://socket.io/docs/).\n\nStandard WebSockets **will** work with a standard WebSocket server as well as the websocket.org echo test. You can use libraries like [ws](https://github.com/websockets/ws) for the server, with [native WebSockets in the browser](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).\n\nEither way, you can proxy WebSocket requests manually in `package.json`:\n\n```js\n{\n  // ...\n  \"proxy\": {\n    \"/socket\": {\n      // Your compatible WebSocket server\n      \"target\": \"ws://<socket_url>\",\n      // Tell http-proxy-middleware that this is a WebSocket proxy.\n      // Also allows you to proxy WebSocket requests without an additional HTTP request\n      // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade\n      \"ws\": true\n      // ...\n    }\n  }\n  // ...\n}\n```\n\n## Using HTTPS in Development\n\n> Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nYou may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the \"proxy\" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS.\n\nTo do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`:\n\n#### Windows (cmd.exe)\n\n```cmd\nset HTTPS=true&&npm start\n```\n\n#### Windows (Powershell)\n\n```Powershell\n($env:HTTPS = $true) -and (npm start)\n```\n\n(Note: the lack of whitespace is intentional.)\n\n#### Linux, macOS (Bash)\n\n```bash\nHTTPS=true npm start\n```\n\nNote that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page.\n\n## Generating Dynamic `<meta>` Tags on the Server\n\nSince Create React App doesn’t support server rendering, you might be wondering how to make `<meta>` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta property=\"og:title\" content=\"__OG_TITLE__\" />\n    <meta property=\"og:description\" content=\"__OG_DESCRIPTION__\" />\n  </head>\n</html>\n```\n\nThen, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!\n\nIf you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases.\n\n## Pre-Rendering into Static HTML Files\n\nIf you’re hosting your `build` with a static hosting provider you can use [react-snapshot](https://www.npmjs.com/package/react-snapshot) or [react-snap](https://github.com/stereobooster/react-snap) to generate HTML pages for each route, or relative link, in your application. These pages will then seamlessly become active, or “hydrated”, when the JavaScript bundle has loaded.\n\nThere are also opportunities to use this outside of static hosting, to take the pressure off the server when generating and caching routes.\n\nThe primary benefit of pre-rendering is that you get the core content of each page _with_ the HTML payload—regardless of whether or not your JavaScript bundle successfully downloads. It also increases the likelihood that each route of your application will be picked up by search engines.\n\nYou can read more about [zero-configuration pre-rendering (also called snapshotting) here](https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319).\n\n## Injecting Data from the Server into the Page\n\nSimilarly to the previous section, you can leave some placeholders in the HTML that inject global variables, for example:\n\n```js\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <script>\n      window.SERVER_DATA = __SERVER_DATA__;\n    </script>\n```\n\nThen, on the server, you can replace `__SERVER_DATA__` with a JSON of real data right before sending the response. The client code can then read `window.SERVER_DATA` to use it. **Make sure to [sanitize the JSON before sending it to the client](https://medium.com/node-security/the-most-common-xss-vulnerability-in-react-js-applications-2bdffbcc1fa0) as it makes your app vulnerable to XSS attacks.**\n\n## Running Tests\n\n> Note: this feature is available with `react-scripts@0.3.0` and higher.<br> >[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030)\n\nCreate React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try.\n\nJest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This lets us enable fast iteration speed and prevent flakiness.\n\nWhile Jest provides browser globals such as `window` thanks to [jsdom](https://github.com/tmpvar/jsdom), they are only approximations of the real browser behavior. Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks.\n\nWe recommend that you use a separate tool for browser end-to-end tests if you need them. They are beyond the scope of Create React App.\n\n### Filename Conventions\n\nJest will look for test files with any of the following popular naming conventions:\n\n- Files with `.js` suffix in `__tests__` folders.\n- Files with `.test.js` suffix.\n- Files with `.spec.js` suffix.\n\nThe `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder.\n\nWe recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Colocation also helps find tests more quickly in larger projects.\n\n### Command Line Interface\n\nWhen you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code.\n\nThe watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run:\n\n![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif)\n\n### Version Control Integration\n\nBy default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests.\n\nJest will always explicitly mention that it only ran tests related to the files changed since the last commit. You can also press `a` in the watch mode to force Jest to run all tests.\n\nJest will always run all tests on a [continuous integration](#continuous-integration) server or if the project is not inside a Git or Mercurial repository.\n\n### Writing Tests\n\nTo create tests, add `it()` (or `test()`) blocks with the name of the test and its code. You may optionally wrap them in `describe()` blocks for logical grouping but this is neither required nor recommended.\n\nJest provides a built-in `expect()` global function for making assertions. A basic test could look like this:\n\n```js\nimport sum from './sum';\n\nit('sums numbers', () => {\n  expect(sum(1, 2)).toEqual(3);\n  expect(sum(2, 2)).toEqual(4);\n});\n```\n\nAll `expect()` matchers supported by Jest are [extensively documented here](https://facebook.github.io/jest/docs/en/expect.html#content).<br>\nYou can also use [`jest.fn()` and `expect(fn).toBeCalled()`](https://facebook.github.io/jest/docs/en/expect.html#tohavebeencalled) to create “spies” or mock functions.\n\n### Testing Components\n\nThere is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes.\n\nDifferent projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components:\n\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n});\n```\n\nThis test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot of value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.js`.\n\nWhen you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior.\n\nIf you’d like to test components in isolation from the child components they render, we recommend using [`shallow()` rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) from [Enzyme](http://airbnb.io/enzyme/). To install it, run:\n\n```sh\nnpm install --save enzyme enzyme-adapter-react-16 react-test-renderer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add enzyme enzyme-adapter-react-16 react-test-renderer\n```\n\nAs of Enzyme 3, you will need to install Enzyme along with an Adapter corresponding to the version of React you are using. (The examples above use the adapter for React 16.)\n\nThe adapter will also need to be configured in your [global setup file](#initializing-test-environment):\n\n#### `src/setupTests.js`\n\n```js\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nconfigure({ adapter: new Adapter() });\n```\n\n> Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it. [Read here](#initializing-test-environment) to learn how to add this after ejecting.\n\nNow you can write a smoke test with it:\n\n```js\nimport React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders without crashing', () => {\n  shallow(<App />);\n});\n```\n\nUnlike the previous smoke test using `ReactDOM.render()`, this test only renders `<App>` and doesn’t go deeper. For example, even if `<App>` itself renders a `<Button>` that throws, this test will pass. Shallow rendering is great for isolated unit tests, but you may still want to create some full rendering tests to ensure the components integrate correctly. Enzyme supports [full rendering with `mount()`](http://airbnb.io/enzyme/docs/api/mount.html), and you can also use it for testing state changes and component lifecycle.\n\nYou can read the [Enzyme documentation](http://airbnb.io/enzyme/) for more testing techniques. Enzyme documentation uses Chai and Sinon for assertions but you don’t have to use them because Jest provides built-in `expect()` and `jest.fn()` for spies.\n\nHere is an example from Enzyme documentation that asserts specific output, rewritten to use Jest matchers:\n\n```js\nimport React from 'react';\nimport { shallow } from 'enzyme';\nimport App from './App';\n\nit('renders welcome message', () => {\n  const wrapper = shallow(<App />);\n  const welcome = <h2>Welcome to React</h2>;\n  // expect(wrapper.contains(welcome)).to.equal(true);\n  expect(wrapper.contains(welcome)).toEqual(true);\n});\n```\n\nAll Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/en/expect.html).<br>\nNevertheless you can use a third-party assertion library like [Chai](http://chaijs.com/) if you want to, as described below.\n\nAdditionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to simplify your tests with readable matchers. The above `contains` code can be written more simply with jest-enzyme.\n\n```js\nexpect(wrapper).toContainReact(welcome);\n```\n\nTo enable this, install `jest-enzyme`:\n\n```sh\nnpm install --save jest-enzyme\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add jest-enzyme\n```\n\nImport it in [`src/setupTests.js`](#initializing-test-environment) to make its matchers available in every test:\n\n```js\nimport 'jest-enzyme';\n```\n\n#### Use `react-testing-library`\n\nAs an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/gnapse/jest-dom) for improved assertions.\n\nTo install `react-testing-library` and `jest-dom`, you can run:\n\n```sh\nnpm install --save react-testing-library jest-dom\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-testing-library jest-dom\n```\n\nSimilar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerplate in your test files:\n\n```js\n// react-testing-library renders your components to document.body,\n// this will ensure they're removed after each test.\nimport 'react-testing-library/cleanup-after-each';\n\n// this adds jest-dom's custom assertions\nimport 'jest-dom/extend-expect';\n```\n\nHere's an example of using `react-testing-library` and `jest-dom` for testing that the `<App />` component renders \"Welcome to React\".\n\n```js\nimport React from 'react';\nimport { render } from 'react-testing-library';\nimport App from './App';\n\nit('renders welcome message', () => {\n  const { getByText } = render(<App />);\n  expect(getByText('Welcome to React')).toBeInTheDOM();\n});\n```\n\nLearn more about the utilities provided by `react-testing-library` to facilitate testing asynchronous interactions as well as selecting form elements from [the `react-testing-library` documentation](https://github.com/kentcdodds/react-testing-library) and [examples](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples).\n\n### Using Third Party Assertion Libraries\n\nWe recommend that you use `expect()` for assertions and `jest.fn()` for spies. If you are having issues with them please [file those against Jest](https://github.com/facebook/jest/issues/new), and we’ll fix them. We intend to keep making them better for React, supporting, for example, [pretty-printing React elements as JSX](https://github.com/facebook/jest/pull/1566).\n\nHowever, if you are used to other libraries, such as [Chai](http://chaijs.com/) and [Sinon](http://sinonjs.org/), or if you have existing code using them that you’d like to port over, you can import them normally like this:\n\n```js\nimport sinon from 'sinon';\nimport { expect } from 'chai';\n```\n\nand then use them in your tests like you normally do.\n\n### Initializing Test Environment\n\n> Note: this feature is available with `react-scripts@0.4.0` and higher.\n\nIf your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests.\n\nFor example:\n\n#### `src/setupTests.js`\n\n```js\nconst localStorageMock = {\n  getItem: jest.fn(),\n  setItem: jest.fn(),\n  clear: jest.fn()\n};\nglobal.localStorage = localStorageMock;\n```\n\n> Note: Keep in mind that if you decide to \"eject\" before creating `src/setupTests.js`, the resulting `package.json` file won't contain any reference to it, so you should manually create the property `setupTestFrameworkScriptFile` in the configuration for Jest, something like the following:\n\n> ```js\n> \"jest\": {\n>   // ...\n>   \"setupTestFrameworkScriptFile\": \"<rootDir>/src/setupTests.js\"\n>  }\n> ```\n\n### Focusing and Excluding Tests\n\nYou can replace `it()` with `xit()` to temporarily exclude a test from being executed.<br>\nSimilarly, `fit()` lets you focus on a specific test without running any other tests.\n\n### Coverage Reporting\n\nJest has an integrated coverage reporter that works well with ES6 and requires no configuration.<br>\nRun `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:\n\n![coverage report](http://i.imgur.com/5bFhnTS.png)\n\nNote that tests run much slower with coverage so it is recommended to run it separately from your normal workflow.\n\n#### Configuration\n\nThe default Jest coverage configuration can be overriden by adding any of the following supported keys to a Jest config in your package.json.\n\nSupported overrides:\n\n- [`collectCoverageFrom`](https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array)\n- [`coverageReporters`](https://facebook.github.io/jest/docs/en/configuration.html#coveragereporters-array-string)\n- [`coverageThreshold`](https://facebook.github.io/jest/docs/en/configuration.html#coveragethreshold-object)\n- [`snapshotSerializers`](https://facebook.github.io/jest/docs/en/configuration.html#snapshotserializers-array-string)\n\nExample package.json:\n\n```json\n{\n  \"name\": \"your-package\",\n  \"jest\": {\n    \"collectCoverageFrom\": [\n      \"src/**/*.{js,jsx}\",\n      \"!<rootDir>/node_modules/\",\n      \"!<rootDir>/path/to/dir/\"\n    ],\n    \"coverageThreshold\": {\n      \"global\": {\n        \"branches\": 90,\n        \"functions\": 90,\n        \"lines\": 90,\n        \"statements\": 90\n      }\n    },\n    \"coverageReporters\": [\"text\"],\n    \"snapshotSerializers\": [\"my-serializer-module\"]\n  }\n}\n```\n\n### Continuous Integration\n\nBy default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI`.\n\nWhen creating a build of your application with `npm run build` linter warnings are not checked by default. Like `npm test`, you can force the build to perform a linter warning check by setting the environment variable `CI`. If any warnings are encountered then the build fails.\n\nPopular CI servers already set the environment variable `CI` by default but you can do this yourself too:\n\n### On CI servers\n\n#### Travis CI\n\n1. Following the [Travis Getting started](https://docs.travis-ci.com/user/getting-started/) guide for syncing your GitHub repository with Travis. You may need to initialize some settings manually in your [profile](https://travis-ci.com/profile) page.\n1. Add a `.travis.yml` file to your git repository.\n\n```\nlanguage: node_js\nnode_js:\n  - 6\ncache:\n  directories:\n    - node_modules\nscript:\n  - npm run build\n  - npm test\n```\n\n1. Trigger your first build with a git push.\n1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed.\n\n#### CircleCI\n\nFollow [this article](https://medium.com/@knowbody/circleci-and-zeits-now-sh-c9b7eebcd3c1) to set up CircleCI with a Create React App project.\n\n### On your own environment\n\n##### Windows (cmd.exe)\n\n```cmd\nset CI=true&&npm test\n```\n\n```cmd\nset CI=true&&npm run build\n```\n\n(Note: the lack of whitespace is intentional.)\n\n##### Windows (Powershell)\n\n```Powershell\n($env:CI = $true) -and (npm test)\n```\n\n```Powershell\n($env:CI = $true) -and (npm run build)\n```\n\n##### Linux, macOS (Bash)\n\n```bash\nCI=true npm test\n```\n\n```bash\nCI=true npm run build\n```\n\nThe test command will force Jest to run tests once instead of launching the watcher.\n\n> If you find yourself doing this often in development, please [file an issue](https://github.com/facebookincubator/create-react-app/issues/new) to tell us about your use case because we want to make watcher the best experience and are open to changing how it works to accommodate more workflows.\n\nThe build command will check for linter warnings and fail if any are found.\n\n### Disabling jsdom\n\nBy default, the `package.json` of the generated project looks like this:\n\n```js\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test --env=jsdom\"\n```\n\nIf you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster:\n\n```diff\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n-   \"test\": \"react-scripts test --env=jsdom\"\n+   \"test\": \"react-scripts test\"\n```\n\nTo help you make up your mind, here is a list of APIs that **need jsdom**:\n\n- Any browser globals like `window` and `document`\n- [`ReactDOM.render()`](https://facebook.github.io/react/docs/top-level-api.html#reactdom.render)\n- [`TestUtils.renderIntoDocument()`](https://facebook.github.io/react/docs/test-utils.html#renderintodocument) ([a shortcut](https://github.com/facebook/react/blob/34761cf9a252964abfaab6faf74d473ad95d1f21/src/test/ReactTestUtils.js#L83-L91) for the above)\n- [`mount()`](http://airbnb.io/enzyme/docs/api/mount.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nIn contrast, **jsdom is not needed** for the following APIs:\n\n- [`TestUtils.createRenderer()`](https://facebook.github.io/react/docs/test-utils.html#shallow-rendering) (shallow rendering)\n- [`shallow()`](http://airbnb.io/enzyme/docs/api/shallow.html) in [Enzyme](http://airbnb.io/enzyme/index.html)\n\nFinally, jsdom is also not needed for [snapshot testing](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html).\n\n### Snapshot Testing\n\nSnapshot testing is a feature of Jest that automatically generates text snapshots of your components and saves them on the disk so if the UI output changes, you get notified without manually writing any assertions on the component output. [Read more about snapshot testing.](http://facebook.github.io/jest/blog/2016/07/27/jest-14.html)\n\n### Editor Integration\n\nIf you use [Visual Studio Code](https://code.visualstudio.com), there is a [Jest extension](https://github.com/orta/vscode-jest) which works with Create React App out of the box. This provides a lot of IDE-like features while using a text editor: showing the status of a test run with potential fail messages inline, starting and stopping the watcher automatically, and offering one-click snapshot updates.\n\n![VS Code Jest Preview](https://cloud.githubusercontent.com/assets/49038/20795349/a032308a-b7c8-11e6-9b34-7eeac781003f.png)\n\n## Debugging Tests\n\nThere are various ways to setup a debugger for your Jest tests. We cover debugging in Chrome and [Visual Studio Code](https://code.visualstudio.com/).\n\n> Note: debugging tests requires Node 8 or higher.\n\n### Debugging Tests in Chrome\n\nAdd the following to the `scripts` section in your project's `package.json`\n\n```json\n\"scripts\": {\n    \"test:debug\": \"react-scripts --inspect-brk test --runInBand --env=jsdom\"\n  }\n```\n\nPlace `debugger;` statements in any test and run:\n\n```bash\n$ npm run test:debug\n```\n\nThis will start running your Jest tests, but pause before executing to allow a debugger to attach to the process.\n\nOpen the following in Chrome\n\n```\nabout:inspect\n```\n\nAfter opening that link, the Chrome Developer Tools will be displayed. Select `inspect` on your process and a breakpoint will be set at the first line of the react script (this is done simply to give you time to open the developer tools and to prevent Jest from executing before you have time to do so). Click the button that looks like a \"play\" button in the upper right hand side of the screen to continue execution. When Jest executes the test that contains the debugger statement, execution will pause and you can examine the current scope and call stack.\n\n> Note: the --runInBand cli option makes sure Jest runs test in the same process rather than spawning processes for individual tests. Normally Jest parallelizes test runs across processes but it is hard to debug many processes at the same time.\n\n### Debugging Tests in Visual Studio Code\n\nDebugging Jest tests is supported out of the box for [Visual Studio Code](https://code.visualstudio.com).\n\nUse the following [`launch.json`](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) configuration file:\n\n```\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"Debug CRA Tests\",\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"runtimeExecutable\": \"${workspaceRoot}/node_modules/.bin/react-scripts\",\n      \"args\": [\n        \"test\",\n        \"--runInBand\",\n        \"--no-cache\",\n        \"--env=jsdom\"\n      ],\n      \"cwd\": \"${workspaceRoot}\",\n      \"protocol\": \"inspector\",\n      \"console\": \"integratedTerminal\",\n      \"internalConsoleOptions\": \"neverOpen\"\n    }\n  ]\n}\n```\n\n## Developing Components in Isolation\n\nUsually, in an app, you have a lot of UI components, and each of them has many different states.\nFor an example, a simple button component could have following states:\n\n- In a regular state, with a text label.\n- In the disabled mode.\n- In a loading state.\n\nUsually, it’s hard to see these states without running a sample app or some examples.\n\nCreate React App doesn’t include any tools for this by default, but you can easily add [Storybook for React](https://storybook.js.org) ([source](https://github.com/storybooks/storybook)) or [React Styleguidist](https://react-styleguidist.js.org/) ([source](https://github.com/styleguidist/react-styleguidist)) to your project. **These are third-party tools that let you develop components and see all their states in isolation from your app**.\n\n![Storybook for React Demo](http://i.imgur.com/7CIAWpB.gif)\n\nYou can also deploy your Storybook or style guide as a static app. This way, everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app.\n\n### Getting Started with Storybook\n\nStorybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.\n\nFirst, install the following npm package globally:\n\n```sh\nnpm install -g @storybook/cli\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\ngetstorybook\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Storybook:\n\n- Screencast: [Getting Started with React Storybook](https://egghead.io/lessons/react-getting-started-with-react-storybook)\n- [GitHub Repo](https://github.com/storybooks/storybook)\n- [Documentation](https://storybook.js.org/basics/introduction/)\n- [Snapshot Testing UI](https://github.com/storybooks/storybook/tree/master/addons/storyshots) with Storybook + addon/storyshot\n\n### Getting Started with Styleguidist\n\nStyleguidist combines a style guide, where all your components are presented on a single page with their props documentation and usage examples, with an environment for developing components in isolation, similar to Storybook. In Styleguidist you write examples in Markdown, where each code snippet is rendered as a live editable playground.\n\nFirst, install Styleguidist:\n\n```sh\nnpm install --save react-styleguidist\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add react-styleguidist\n```\n\nThen, add these scripts to your `package.json`:\n\n```diff\n   \"scripts\": {\n+    \"styleguide\": \"styleguidist server\",\n+    \"styleguide:build\": \"styleguidist build\",\n     \"start\": \"react-scripts start\",\n```\n\nThen, run the following command inside your app’s directory:\n\n```sh\nnpm run styleguide\n```\n\nAfter that, follow the instructions on the screen.\n\nLearn more about React Styleguidist:\n\n- [GitHub Repo](https://github.com/styleguidist/react-styleguidist)\n- [Documentation](https://react-styleguidist.js.org/docs/getting-started.html)\n\n## Publishing Components to npm\n\nCreate React App doesn't provide any built-in functionality to publish a component to npm. If you're ready to extract a component from your project so other people can use it, we recommend moving it to a separate directory outside of your project and then using a tool like [nwb](https://github.com/insin/nwb#react-components-and-libraries) to prepare it for publishing.\n\n## Making a Progressive Web App\n\nBy default, the production build is a fully functional, offline-first\n[Progressive Web App](https://developers.google.com/web/progressive-web-apps/).\n\nProgressive Web Apps are faster and more reliable than traditional web pages, and provide an engaging mobile experience:\n\n- All static site assets are cached so that your page loads fast on subsequent visits, regardless of network connectivity (such as 2G or 3G). Updates are downloaded in the background.\n- Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the subway.\n- On mobile devices, your app can be added directly to the user's home screen, app icon and all. You can also re-engage users using web **push notifications**. This eliminates the need for the app store.\n\nThe [`sw-precache-webpack-plugin`](https://github.com/goldhand/sw-precache-webpack-plugin)\nis integrated into production configuration,\nand it will take care of generating a service worker file that will automatically\nprecache all of your local assets and keep them up to date as you deploy updates.\nThe service worker will use a [cache-first strategy](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network)\nfor handling all requests for local assets, including the initial HTML, ensuring\nthat your web app is reliably fast, even on a slow or unreliable network.\n\n### Opting Out of Caching\n\nIf you would prefer not to enable service workers prior to your initial\nproduction deployment, then remove the call to `registerServiceWorker()`\nfrom [`src/index.js`](src/index.js).\n\nIf you had previously enabled service workers in your production deployment and\nhave decided that you would like to disable them for all your existing users,\nyou can swap out the call to `registerServiceWorker()` in\n[`src/index.js`](src/index.js) first by modifying the service worker import:\n\n```javascript\nimport { unregister } from './registerServiceWorker';\n```\n\nand then call `unregister()` instead.\nAfter the user visits a page that has `unregister()`,\nthe service worker will be uninstalled. Note that depending on how `/service-worker.js` is served,\nit may take up to 24 hours for the cache to be invalidated.\n\n### Offline-First Considerations\n\n1. Service workers [require HTTPS](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers#you_need_https),\n   although to facilitate local testing, that policy\n   [does not apply to `localhost`](http://stackoverflow.com/questions/34160509/options-for-testing-service-workers-via-http/34161385#34161385).\n   If your production web server does not support HTTPS, then the service worker\n   registration will fail, but the rest of your web app will remain functional.\n\n1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/)\n   in all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js)\n   on browsers that lack support.\n\n1. The service worker is only enabled in the [production environment](#deployment),\n   e.g. the output of `npm run build`. It's recommended that you do not enable an\n   offline-first service worker in a development environment, as it can lead to\n   frustration when previously cached assets are used and do not include the latest\n   changes you've made locally.\n\n1. If you _need_ to test your offline-first service worker locally, build\n   the application (using `npm run build`) and run a simple http server from your\n   build directory. After running the build script, `create-react-app` will give\n   instructions for one way to test your production build locally and the [deployment instructions](#deployment) have\n   instructions for using other methods. _Be sure to always use an\n   incognito window to avoid complications with your browser cache._\n\n1. If possible, configure your production environment to serve the generated\n   `service-worker.js` [with HTTP caching disabled](http://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours).\n   If that's not possible—[GitHub Pages](#github-pages), for instance, does not\n   allow you to change the default 10 minute HTTP cache lifetime—then be aware\n   that if you visit your production site, and then revisit again before\n   `service-worker.js` has expired from your HTTP cache, you'll continue to get\n   the previously cached assets from the service worker. If you have an immediate\n   need to view your updated production deployment, performing a shift-refresh\n   will temporarily disable the service worker and retrieve all assets from the\n   network.\n\n1. Users aren't always familiar with offline-first web apps. It can be useful to\n   [let the user know](https://developers.google.com/web/fundamentals/instant-and-offline/offline-ux#inform_the_user_when_the_app_is_ready_for_offline_consumption)\n   when the service worker has finished populating your caches (showing a \"This web\n   app works offline!\" message) and also let them know when the service worker has\n   fetched the latest updates that will be available the next time they load the\n   page (showing a \"New content is available; please refresh.\" message). Showing\n   this messages is currently left as an exercise to the developer, but as a\n   starting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which\n   demonstrates which service worker lifecycle events to listen for to detect each\n   scenario, and which as a default, just logs appropriate messages to the\n   JavaScript console.\n\n1. By default, the generated service worker file will not intercept or cache any\n   cross-origin traffic, like HTTP [API requests](#integrating-with-an-api-backend),\n   images, or embeds loaded from a different domain. If you would like to use a\n   runtime caching strategy for those requests, you can [`eject`](#npm-run-eject)\n   and then configure the\n   [`runtimeCaching`](https://github.com/GoogleChrome/sw-precache#runtimecaching-arrayobject)\n   option in the `SWPrecacheWebpackPlugin` section of\n   [`webpack.config.prod.js`](../config/webpack.config.prod.js).\n\n### Progressive Web App Metadata\n\nThe default configuration includes a web app manifest located at\n[`public/manifest.json`](public/manifest.json), that you can customize with\ndetails specific to your web application.\n\nWhen a user adds a web app to their homescreen using Chrome or Firefox on\nAndroid, the metadata in [`manifest.json`](public/manifest.json) determines what\nicons, names, and branding colors to use when the web app is displayed.\n[The Web App Manifest guide](https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/)\nprovides more context about what each field means, and how your customizations\nwill affect your users' experience.\n\n## Analyzing the Bundle Size\n\n[Source map explorer](https://www.npmjs.com/package/source-map-explorer) analyzes\nJavaScript bundles using the source maps. This helps you understand where code\nbloat is coming from.\n\nTo add Source map explorer to a Create React App project, follow these steps:\n\n```sh\nnpm install --save source-map-explorer\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add source-map-explorer\n```\n\nThen in `package.json`, add the following line to `scripts`:\n\n```diff\n   \"scripts\": {\n+    \"analyze\": \"source-map-explorer build/static/js/main.*\",\n     \"start\": \"react-scripts start\",\n     \"build\": \"react-scripts build\",\n     \"test\": \"react-scripts test --env=jsdom\",\n```\n\nThen to analyze the bundle run the production build then run the analyze\nscript.\n\n```\nnpm run build\nnpm run analyze\n```\n\n## Deployment\n\n`npm run build` creates a `build` directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served `index.html`, and requests to static paths like `/static/js/main.<hash>.js` are served with the contents of the `/static/js/main.<hash>.js` file.\n\n### Static Server\n\nFor environments using [Node](https://nodejs.org/), the easiest way to handle this would be to install [serve](https://github.com/zeit/serve) and let it handle the rest:\n\n```sh\nnpm install -g serve\nserve -s build\n```\n\nThe last command shown above will serve your static site on the port **5000**. Like many of [serve](https://github.com/zeit/serve)’s internal settings, the port can be adjusted using the `-p` or `--port` flags.\n\nRun this command to get a full list of the options available:\n\n```sh\nserve -h\n```\n\n### Other Solutions\n\nYou don’t necessarily need a static server in order to run a Create React App project in production. It works just as fine integrated into an existing dynamic one.\n\nHere’s a programmatic example using [Node](https://nodejs.org/) and [Express](http://expressjs.com/):\n\n```javascript\nconst express = require('express');\nconst path = require('path');\nconst app = express();\n\napp.use(express.static(path.join(__dirname, 'build')));\n\napp.get('/', function(req, res) {\n  res.sendFile(path.join(__dirname, 'build', 'index.html'));\n});\n\napp.listen(9000);\n```\n\nThe choice of your server software isn’t important either. Since Create React App is completely platform-agnostic, there’s no need to explicitly use Node.\n\nThe `build` folder with static assets is the only output produced by Create React App.\n\nHowever this is not quite enough if you use client-side routing. Read the next section if you want to support URLs like `/todos/42` in your single-page app.\n\n### Serving Apps with Client-Side Routing\n\nIf you use routers that use the HTML5 [`pushState` history API](https://developer.mozilla.org/en-US/docs/Web/API/History_API#Adding_and_modifying_history_entries) under the hood (for example, [React Router](https://github.com/ReactTraining/react-router) with `browserHistory`), many static file servers will fail. For example, if you used React Router with a route for `/todos/42`, the development server will respond to `localhost:3000/todos/42` properly, but an Express serving a production build as above will not.\n\nThis is because when there is a fresh page load for a `/todos/42`, the server looks for the file `build/todos/42` and does not find it. The server needs to be configured to respond to a request to `/todos/42` by serving `index.html`. For example, we can amend our Express example above to serve `index.html` for any unknown paths:\n\n```diff\n app.use(express.static(path.join(__dirname, 'build')));\n\n-app.get('/', function (req, res) {\n+app.get('/*', function (req, res) {\n   res.sendFile(path.join(__dirname, 'build', 'index.html'));\n });\n```\n\nIf you’re using [Apache HTTP Server](https://httpd.apache.org/), you need to create a `.htaccess` file in the `public` folder that looks like this:\n\n```\n    Options -MultiViews\n    RewriteEngine On\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteRule ^ index.html [QSA,L]\n```\n\nIt will get copied to the `build` folder when you run `npm run build`.\n\nIf you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow [this Stack Overflow answer](https://stackoverflow.com/a/41249464/4878474).\n\nNow requests to `/todos/42` will be handled correctly both in development and in production.\n\nOn a production build, and in a browser that supports [service workers](https://developers.google.com/web/fundamentals/getting-started/primers/service-workers),\nthe service worker will automatically handle all navigation requests, like for\n`/todos/42`, by serving the cached copy of your `index.html`. This\nservice worker navigation routing can be configured or disabled by\n[`eject`ing](#npm-run-eject) and then modifying the\n[`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string)\nand [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp)\noptions of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js).\n\nWhen users install your app to the homescreen of their device the default configuration will make a shortcut to `/index.html`. This may not work for client-side routers which expect the app to be served from `/`. Edit the web app manifest at [`public/manifest.json`](public/manifest.json) and change `start_url` to match the required URL scheme, for example:\n\n```js\n  \"start_url\": \".\",\n```\n\n### Building for Relative Paths\n\nBy default, Create React App produces a build assuming your app is hosted at the server root.<br>\nTo override this, specify the `homepage` in your `package.json`, for example:\n\n```js\n  \"homepage\": \"http://mywebsite.com/relativepath\",\n```\n\nThis will let Create React App correctly infer the root path to use in the generated HTML file.\n\n**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>\nMore information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>\n<br>\nFor example:\n\n```js\n<BrowserRouter basename=\"/calendar\"/>\n<Link to=\"/today\"/> // renders <a href=\"/calendar/today\">\n```\n\n#### Serving the Same Build from Different Paths\n\n> Note: this feature is available with `react-scripts@0.9.0` and higher.\n\nIf you are not using the HTML5 `pushState` history API or not using client-side routing at all, it is unnecessary to specify the URL from which your app will be served. Instead, you can put this in your `package.json`:\n\n```js\n  \"homepage\": \".\",\n```\n\nThis will make sure that all the asset paths are relative to `index.html`. You will then be able to move your app from `http://mywebsite.com` to `http://mywebsite.com/relativepath` or even `http://mywebsite.com/relative/path` without having to rebuild it.\n\n### [Azure](https://azure.microsoft.com/)\n\nSee [this](https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321) blog post on how to deploy your React app to Microsoft Azure.\n\nSee [this](https://medium.com/@strid/host-create-react-app-on-azure-986bc40d5bf2#.pycfnafbg) blog post or [this](https://github.com/ulrikaugustsson/azure-appservice-static) repo for a way to use automatic deployment to Azure App Service.\n\n### [Firebase](https://firebase.google.com/)\n\nInstall the Firebase CLI if you haven’t already by running `npm install -g firebase-tools`. Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project. Run `firebase login` and login with your previous created Firebase account.\n\nThen run the `firebase init` command from your project’s root. You need to choose the **Hosting: Configure and deploy Firebase Hosting sites** and choose the Firebase project you created in the previous step. You will need to agree with `database.rules.json` being created, choose `build` as the public directory, and also agree to **Configure as a single-page app** by replying with `y`.\n\n```sh\n    === Project Setup\n\n    First, let's associate this project directory with a Firebase project.\n    You can create multiple project aliases by running firebase use --add,\n    but for now we'll just set up a default project.\n\n    ? What Firebase project do you want to associate as default? Example app (example-app-fd690)\n\n    === Database Setup\n\n    Firebase Realtime Database Rules allow you to define how your data should be\n    structured and when your data can be read from and written to.\n\n    ? What file should be used for Database Rules? database.rules.json\n    ✔  Database Rules for example-app-fd690 have been downloaded to database.rules.json.\n    Future modifications to database.rules.json will update Database Rules when you run\n    firebase deploy.\n\n    === Hosting Setup\n\n    Your public directory is the folder (relative to your project directory) that\n    will contain Hosting assets to uploaded with firebase deploy. If you\n    have a build process for your assets, use your build's output directory.\n\n    ? What do you want to use as your public directory? build\n    ? Configure as a single-page app (rewrite all urls to /index.html)? Yes\n    ✔  Wrote build/index.html\n\n    i  Writing configuration info to firebase.json...\n    i  Writing project information to .firebaserc...\n\n    ✔  Firebase initialization complete!\n```\n\nIMPORTANT: you need to set proper HTTP caching headers for `service-worker.js` file in `firebase.json` file or you will not be able to see changes after first deployment ([issue #2440](https://github.com/facebookincubator/create-react-app/issues/2440)). It should be added inside `\"hosting\"` key like next:\n\n```\n{\n  \"hosting\": {\n    ...\n    \"headers\": [\n      {\"source\": \"/service-worker.js\", \"headers\": [{\"key\": \"Cache-Control\", \"value\": \"no-cache\"}]}\n    ]\n    ...\n```\n\nNow, after you create a production build with `npm run build`, you can deploy it by running `firebase deploy`.\n\n```sh\n    === Deploying to 'example-app-fd690'...\n\n    i  deploying database, hosting\n    ✔  database: rules ready to deploy.\n    i  hosting: preparing build directory for upload...\n    Uploading: [==============================          ] 75%✔  hosting: build folder uploaded successfully\n    ✔  hosting: 8 files uploaded successfully\n    i  starting release process (may take several minutes)...\n\n    ✔  Deploy complete!\n\n    Project Console: https://console.firebase.google.com/project/example-app-fd690/overview\n    Hosting URL: https://example-app-fd690.firebaseapp.com\n```\n\nFor more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).\n\n### [GitHub Pages](https://pages.github.com/)\n\n> Note: this feature is available with `react-scripts@0.2.0` and higher.\n\n#### Step 1: Add `homepage` to `package.json`\n\n**The step below is important!**<br>\n**If you skip it, your app will not deploy correctly.**\n\nOpen your `package.json` and add a `homepage` field for your project:\n\n```json\n  \"homepage\": \"https://myusername.github.io/my-app\",\n```\n\nor for a GitHub user page:\n\n```json\n  \"homepage\": \"https://myusername.github.io\",\n```\n\nCreate React App uses the `homepage` field to determine the root URL in the built HTML file.\n\n#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`\n\nNow, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.\n\nTo publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:\n\n```sh\nnpm install --save gh-pages\n```\n\nAlternatively you may use `yarn`:\n\n```sh\nyarn add gh-pages\n```\n\nAdd the following scripts in your `package.json`:\n\n```diff\n  \"scripts\": {\n+   \"predeploy\": \"npm run build\",\n+   \"deploy\": \"gh-pages -d build\",\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n```\n\nThe `predeploy` script will run automatically before `deploy` is run.\n\nIf you are deploying to a GitHub user page instead of a project page you'll need to make two\nadditional modifications:\n\n1. First, change your repository's source branch to be any branch other than **master**.\n1. Additionally, tweak your `package.json` scripts to push deployments to **master**:\n\n```diff\n  \"scripts\": {\n    \"predeploy\": \"npm run build\",\n-   \"deploy\": \"gh-pages -d build\",\n+   \"deploy\": \"gh-pages -b master -d build\",\n```\n\n#### Step 3: Deploy the site by running `npm run deploy`\n\nThen run:\n\n```sh\nnpm run deploy\n```\n\n#### Step 4: Ensure your project’s settings use `gh-pages`\n\nFinally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:\n\n<img src=\"http://i.imgur.com/HUjEr9l.png\" width=\"500\" alt=\"gh-pages branch setting\">\n\n#### Step 5: Optionally, configure the domain\n\nYou can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.\n\n#### Notes on client-side routing\n\nGitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:\n\n- You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.\n- Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).\n\n#### Troubleshooting\n\n##### \"/dev/tty: No such a device or address\"\n\nIf, when deploying, you get `/dev/tty: No such a device or address` or a similar error, try the follwing:\n\n1. Create a new [Personal Access Token](https://github.com/settings/tokens)\n2. `git remote set-url origin https://<user>:<token>@github.com/<user>/<repo>` .\n3. Try `npm run deploy again`\n\n### [Heroku](https://www.heroku.com/)\n\nUse the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>\nYou can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).\n\n#### Resolving Heroku Deployment Errors\n\nSometimes `npm run build` works locally but fails during deploy via Heroku. Following are the most common cases.\n\n##### \"Module not found: Error: Cannot resolve 'file' or 'directory'\"\n\nIf you get something like this:\n\n```\nremote: Failed to create a production build. Reason:\nremote: Module not found: Error: Cannot resolve 'file' or 'directory'\nMyDirectory in /tmp/build_1234/src\n```\n\nIt means you need to ensure that the lettercase of the file or directory you `import` matches the one you see on your filesystem or on GitHub.\n\nThis is important because Linux (the operating system used by Heroku) is case sensitive. So `MyDirectory` and `mydirectory` are two distinct directories and thus, even though the project builds locally, the difference in case breaks the `import` statements on Heroku remotes.\n\n##### \"Could not find a required file.\"\n\nIf you exclude or ignore necessary files from the package you will see a error similar this one:\n\n```\nremote: Could not find a required file.\nremote:   Name: `index.html`\nremote:   Searched in: /tmp/build_a2875fc163b209225122d68916f1d4df/public\nremote:\nremote: npm ERR! Linux 3.13.0-105-generic\nremote: npm ERR! argv \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/node\" \"/tmp/build_a2875fc163b209225122d68916f1d4df/.heroku/node/bin/npm\" \"run\" \"build\"\n```\n\nIn this case, ensure that the file is there with the proper lettercase and that’s not ignored on your local `.gitignore` or `~/.gitignore_global`.\n\n### [Netlify](https://www.netlify.com/)\n\n**To do a manual deploy to Netlify’s CDN:**\n\n```sh\nnpm install netlify-cli -g\nnetlify deploy\n```\n\nChoose `build` as the path to deploy.\n\n**To setup continuous delivery:**\n\nWith this setup Netlify will build and deploy when you push to git or open a pull request:\n\n1. [Start a new netlify project](https://app.netlify.com/signup)\n2. Pick your Git hosting service and select your repository\n3. Set `yarn build` as the build command and `build` as the publish directory\n4. Click `Deploy site`\n\n**Support for client-side routing:**\n\nTo support `pushState`, make sure to create a `public/_redirects` file with the following rewrite rules:\n\n```\n/*  /index.html  200\n```\n\nWhen you build the project, Create React App will place the `public` folder contents into the build output.\n\n### [Now](https://zeit.co/now)\n\nNow offers a zero-configuration single-command deployment. You can use `now` to deploy your app for free.\n\n1. Install the `now` command-line tool either via the recommended [desktop tool](https://zeit.co/download) or via node with `npm install -g now`.\n\n2. Build your app by running `npm run build`.\n\n3. Move into the build directory by running `cd build`.\n\n4. Run `now --name your-project-name` from within the build directory. You will see a **now.sh** URL in your output like this:\n\n   ```\n   > Ready! https://your-project-name-tpspyhtdtk.now.sh (copied to clipboard)\n   ```\n\n   Paste that URL into your browser when the build is complete, and you will see your deployed app.\n\nDetails are available in [this article.](https://zeit.co/blog/unlimited-static)\n\n### [S3](https://aws.amazon.com/s3) and [CloudFront](https://aws.amazon.com/cloudfront/)\n\nSee this [blog post](https://medium.com/@omgwtfmarc/deploying-create-react-app-to-s3-or-cloudfront-48dae4ce0af) on how to deploy your React app to Amazon Web Services S3 and CloudFront.\n\n### [Surge](https://surge.sh/)\n\nInstall the Surge CLI if you haven’t already by running `npm install -g surge`. Run the `surge` command and log in you or create a new account.\n\nWhen asked about the project path, make sure to specify the `build` folder, for example:\n\n```sh\n       project path: /path/to/project/build\n```\n\nNote that in order to support routers that use HTML5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).\n\n## Advanced Configuration\n\nYou can adjust various development and production settings by setting environment variables in your shell or with [.env](#adding-development-environment-variables-in-env).\n\n| Variable            |      Development       |     Production     | Usage                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| :------------------ | :--------------------: | :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| BROWSER             |   :white_check_mark:   |        :x:         | By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a [browser](https://github.com/sindresorhus/opn#app) to override this behavior, or set it to `none` to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to `npm start` will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the `.js` extension.                                                                                                                                                |\n| HOST                |   :white_check_mark:   |        :x:         | By default, the development web server binds to `localhost`. You may use this variable to specify a different host.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| PORT                |   :white_check_mark:   |        :x:         | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| HTTPS               |   :white_check_mark:   |        :x:         | When set to `true`, Create React App will run the development server in `https` mode.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n| PUBLIC_URL          |          :x:           | :white_check_mark: | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application.                                                                                                                                                                                                                                                        |\n| CI                  | :large_orange_diamond: | :white_check_mark: | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| REACT_EDITOR        |   :white_check_mark:   |        :x:         | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](<https://en.wikipedia.org/wiki/PATH_(variable)>) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. |\n| CHOKIDAR_USEPOLLING |   :white_check_mark:   |        :x:         | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |\n| GENERATE_SOURCEMAP  |          :x:           | :white_check_mark: | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| NODE_PATH           |   :white_check_mark:   | :white_check_mark: | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n\n## Troubleshooting\n\n### `npm start` doesn’t detect changes\n\nWhen you save a file while `npm start` is running, the browser should refresh with the updated code.<br>\nIf this doesn’t happen, try one of the following workarounds:\n\n- If your project is in a Dropbox folder, try moving it out.\n- If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebookincubator/create-react-app/issues/1164) due to a Webpack bug.\n- Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).\n- If your project path contains parentheses, try moving the project to a path without them. This is caused by a [Webpack watcher bug](https://github.com/webpack/watchpack/issues/42).\n- On Linux and macOS, you might need to [tweak system settings](https://github.com/webpack/docs/wiki/troubleshooting#not-enough-watchers) to allow more watchers.\n- If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an `.env` file in your project directory if it doesn’t exist, and add `CHOKIDAR_USEPOLLING=true` to it. This ensures that the next time you run `npm start`, the watcher uses the polling mode, as necessary inside a VM.\n\nIf none of these solutions help please leave a comment [in this thread](https://github.com/facebookincubator/create-react-app/issues/659).\n\n### `npm test` hangs on macOS Sierra\n\nIf you run `npm test` and the console gets stuck after printing `react-scripts test --env=jsdom` to the console there might be a problem with your [Watchman](https://facebook.github.io/watchman/) installation as described in [facebookincubator/create-react-app#713](https://github.com/facebookincubator/create-react-app/issues/713).\n\nWe recommend deleting `node_modules` in your project and running `npm install` (or `yarn` if you use it) first. If it doesn't help, you can try one of the numerous workarounds mentioned in these issues:\n\n- [facebook/jest#1767](https://github.com/facebook/jest/issues/1767)\n- [facebook/watchman#358](https://github.com/facebook/watchman/issues/358)\n- [ember-cli/ember-cli#6259](https://github.com/ember-cli/ember-cli/issues/6259)\n\nIt is reported that installing Watchman 4.7.0 or newer fixes the issue. If you use [Homebrew](http://brew.sh/), you can run these commands to update it:\n\n```\nwatchman shutdown-server\nbrew update\nbrew reinstall watchman\n```\n\nYou can find [other installation methods](https://facebook.github.io/watchman/docs/install.html#build-install) on the Watchman documentation page.\n\nIf this still doesn’t help, try running `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`.\n\nThere are also reports that _uninstalling_ Watchman fixes the issue. So if nothing else helps, remove it from your system and try again.\n\n### `npm run build` exits too early\n\nIt is reported that `npm run build` can fail on machines with limited memory and no swap space, which is common in cloud environments. Even with small projects this command can increase RAM usage in your system by hundreds of megabytes, so if you have less than 1 GB of available memory your build is likely to fail with the following message:\n\n> The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.\n\nIf you are completely sure that you didn't terminate the process, consider [adding some swap space](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04) to the machine you’re building on, or build the project locally.\n\n### `npm run build` fails on Heroku\n\nThis may be a problem with case sensitive filenames.\nPlease refer to [this section](#resolving-heroku-deployment-errors).\n\n### Moment.js locales are missing\n\nIf you use a [Moment.js](https://momentjs.com/), you might notice that only the English locale is available by default. This is because the locale files are large, and you probably only need a subset of [all the locales provided by Moment.js](https://momentjs.com/#multiple-locale-support).\n\nTo add a specific Moment.js locale to your bundle, you need to import it explicitly.<br>\nFor example:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\n```\n\nIf import multiple locales this way, you can later switch between them by calling `moment.locale()` with the locale name:\n\n```js\nimport moment from 'moment';\nimport 'moment/locale/fr';\nimport 'moment/locale/es';\n\n// ...\n\nmoment.locale('fr');\n```\n\nThis will only work for locales that have been explicitly imported before.\n\n### `npm run build` fails to minify\n\nSome third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.\n\n<br>\nTo resolve this:\n\n1. Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.\n\n- Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the `module` field in `package.json`. Note that **even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers**.\n\n2. Fork the package and publish a corrected version yourself.\n\n3. If the dependency is small enough, copy it to your `src/` folder and treat it as application code.\n\nIn the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.\n\n## Alternatives to Ejecting\n\n[Ejecting](#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebookincubator/create-react-app/issues/682).\n\n## Something Missing?\n\nIf you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/packages/react-scripts/template/README.md)\n"
  },
  {
    "path": "examples/dummy-app/package.json",
    "content": "{\n  \"name\": \"@pollyjs/dummy-app\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"prop-types\": \"^15.6.2\",\n    \"ra-data-json-server\": \"^2.3.1\",\n    \"react\": \"^16.5.1\",\n    \"react-admin\": \"^2.3.1\",\n    \"react-dom\": \"^16.5.1\",\n    \"react-scripts\": \"^1.1.5\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"start:ci\": \"BROWSER=none CI=true yarn start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test --env=jsdom\",\n    \"eject\": \"react-scripts eject\"\n  }\n}\n"
  },
  {
    "path": "examples/dummy-app/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta\n      name=\"viewport\"\n      content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"\n    />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <!--\n      manifest.json provides metadata used when your web app is added to the\n      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" />\n    <link rel=\"shortcut icon\" href=\"%PUBLIC_URL%/favicon.ico\" />\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>Dummy App</title>\n  </head>\n  <body>\n    <noscript> You need to enable JavaScript to run this app. </noscript>\n    <div id=\"root\"></div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "examples/dummy-app/public/manifest.json",
    "content": "{\n  \"short_name\": \"Dummy App\",\n  \"name\": \"Polly.JS Examples Dummy App\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    }\n  ],\n  \"start_url\": \"./index.html\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/dummy-app/src/App.js",
    "content": "import React from 'react';\nimport { Admin, Resource } from 'react-admin';\nimport jsonServerProvider from 'ra-data-json-server';\nimport PostIcon from '@material-ui/icons/Book';\nimport TodoIcon from '@material-ui/icons/ViewList';\nimport UserIcon from '@material-ui/icons/Group';\nimport { createMuiTheme } from '@material-ui/core/styles';\n\nimport { UserList, UserShow } from './users';\nimport { TodoList, TodoShow, TodoEdit, TodoCreate } from './todos';\nimport { PostList, PostShow, PostEdit, PostCreate } from './posts';\n\nconst dataProvider = jsonServerProvider('https://jsonplaceholder.typicode.com');\nconst theme = createMuiTheme({\n  palette: {\n    primary: {\n      light: '#ff5740',\n      main: '#e50914',\n      dark: '#aa0000',\n      contrastText: '#fff'\n    },\n    secondary: {\n      light: '#ff5740',\n      main: '#e50914',\n      dark: '#aa0000',\n      contrastText: '#fff'\n    }\n  }\n});\n\nconst App = () => (\n  <Admin theme={theme} dataProvider={dataProvider}>\n    <Resource\n      name=\"posts\"\n      list={PostList}\n      show={PostShow}\n      edit={PostEdit}\n      create={PostCreate}\n      icon={PostIcon}\n    />\n    <Resource\n      name=\"todos\"\n      list={TodoList}\n      show={TodoShow}\n      edit={TodoEdit}\n      create={TodoCreate}\n      icon={TodoIcon}\n    />\n    <Resource name=\"users\" list={UserList} show={UserShow} icon={UserIcon} />\n  </Admin>\n);\n\nexport default App;\n"
  },
  {
    "path": "examples/dummy-app/src/index.css",
    "content": "body {\n  margin: 0;\n  padding: 0;\n}\n"
  },
  {
    "path": "examples/dummy-app/src/index.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport './index.css';\nimport App from './App';\n\nReactDOM.render(<App />, document.getElementById('root'));\n"
  },
  {
    "path": "examples/dummy-app/src/posts.js",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Edit,\n  Create,\n  Datagrid,\n  ReferenceField,\n  TextField,\n  EditButton,\n  ShowButton,\n  DisabledInput,\n  LongTextInput,\n  ReferenceInput,\n  SelectInput,\n  SimpleForm,\n  TextInput,\n  Filter,\n  Show,\n  SimpleShowLayout\n} from 'react-admin';\n\nconst PostFilter = (props) => (\n  <Filter {...props}>\n    <TextInput label=\"Search\" source=\"q\" alwaysOn />\n    <ReferenceInput label=\"User\" source=\"userId\" reference=\"users\" allowEmpty>\n      <SelectInput optionText=\"name\" />\n    </ReferenceInput>\n  </Filter>\n);\n\nconst PostTitle = ({ record }) => {\n  return <span>Posts - {record ? `${record.title}` : ''}</span>;\n};\n\nPostTitle.propTypes = {\n  record: PropTypes.PropTypes.shape({\n    title: PropTypes.string\n  })\n};\n\nexport const PostList = (props) => (\n  <List\n    title=\"Posts\"\n    {...props}\n    filters={<PostFilter />}\n    sort={{ field: 'title', order: 'ASC' }}\n  >\n    <Datagrid>\n      <TextField source=\"title\" />\n      <TextField source=\"body\" />\n      <ReferenceField\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <TextField source=\"name\" />\n      </ReferenceField>\n      <ShowButton />\n      <EditButton />\n    </Datagrid>\n  </List>\n);\n\nexport const PostShow = (props) => (\n  <Show title={<PostTitle />} {...props}>\n    <SimpleShowLayout>\n      <TextField source=\"id\" />\n      <TextField source=\"title\" />\n      <TextField source=\"body\" />\n      <ReferenceField\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <TextField source=\"name\" />\n      </ReferenceField>\n    </SimpleShowLayout>\n  </Show>\n);\n\nexport const PostEdit = (props) => (\n  <Edit title={<PostTitle />} {...props}>\n    <SimpleForm>\n      <DisabledInput source=\"id\" />\n      <TextInput source=\"title\" />\n      <LongTextInput source=\"body\" />\n      <ReferenceInput\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <SelectInput optionText=\"name\" />\n      </ReferenceInput>\n    </SimpleForm>\n  </Edit>\n);\n\nexport const PostCreate = (props) => (\n  <Create {...props}>\n    <SimpleForm>\n      <TextInput source=\"title\" />\n      <LongTextInput source=\"body\" />\n      <ReferenceInput\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <SelectInput optionText=\"name\" />\n      </ReferenceInput>\n    </SimpleForm>\n  </Create>\n);\n"
  },
  {
    "path": "examples/dummy-app/src/todos.js",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Edit,\n  Create,\n  Show,\n  Datagrid,\n  BooleanField,\n  ReferenceField,\n  TextField,\n  DisabledInput,\n  SelectInput,\n  ShowButton,\n  EditButton,\n  SimpleForm,\n  SimpleShowLayout,\n  TextInput,\n  BooleanInput,\n  ReferenceInput,\n  Filter\n} from 'react-admin';\n\nconst TodoFilter = (props) => (\n  <Filter {...props}>\n    <TextInput label=\"Search\" source=\"q\" alwaysOn />\n    <ReferenceInput label=\"User\" source=\"userId\" reference=\"users\" allowEmpty>\n      <SelectInput optionText=\"name\" />\n    </ReferenceInput>\n  </Filter>\n);\n\nconst TodoTitle = ({ record }) => {\n  return <span>Todos - {record ? `${record.title}` : ''}</span>;\n};\n\nTodoTitle.propTypes = {\n  record: PropTypes.PropTypes.shape({\n    title: PropTypes.string\n  })\n};\n\nexport const TodoList = (props) => (\n  <List\n    title=\"Todos\"\n    {...props}\n    filters={<TodoFilter />}\n    sort={{ field: 'title', order: 'ASC' }}\n  >\n    <Datagrid>\n      <BooleanField source=\"completed\" />\n      <TextField source=\"title\" />\n      <ReferenceField\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <TextField source=\"name\" />\n      </ReferenceField>\n      <ShowButton />\n      <EditButton />\n    </Datagrid>\n  </List>\n);\n\nexport const TodoShow = (props) => (\n  <Show title={<TodoTitle />} {...props}>\n    <SimpleShowLayout>\n      <TextField source=\"id\" />\n      <TextField source=\"title\" />\n      <BooleanField source=\"completed\" />\n      <ReferenceField\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <TextField source=\"name\" />\n      </ReferenceField>\n    </SimpleShowLayout>\n  </Show>\n);\n\nexport const TodoEdit = (props) => (\n  <Edit title={<TodoTitle />} {...props}>\n    <SimpleForm>\n      <DisabledInput source=\"id\" />\n      <TextInput source=\"title\" />\n      <BooleanInput source=\"completed\" />\n      <ReferenceInput\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <SelectInput optionText=\"name\" />\n      </ReferenceInput>\n    </SimpleForm>\n  </Edit>\n);\n\nexport const TodoCreate = (props) => (\n  <Create {...props}>\n    <SimpleForm>\n      <TextInput source=\"title\" />\n      <BooleanInput source=\"completed\" />\n      <ReferenceInput\n        label=\"User\"\n        source=\"userId\"\n        reference=\"users\"\n        linkType=\"show\"\n      >\n        <SelectInput optionText=\"name\" />\n      </ReferenceInput>\n    </SimpleForm>\n  </Create>\n);\n"
  },
  {
    "path": "examples/dummy-app/src/users.js",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n  List,\n  Datagrid,\n  EmailField,\n  TextField,\n  Show,\n  SimpleShowLayout,\n  ShowButton\n} from 'react-admin';\n\nconst UserTitle = ({ record }) => {\n  return <span>Users - {record ? `${record.name}` : ''}</span>;\n};\n\nUserTitle.propTypes = {\n  record: PropTypes.PropTypes.shape({\n    name: PropTypes.string\n  })\n};\n\nexport const UserList = (props) => (\n  <List title=\"Users\" {...props} sort={{ field: 'name', order: 'ASC' }}>\n    <Datagrid>\n      <TextField source=\"name\" />\n      <TextField source=\"username\" />\n      <EmailField source=\"email\" />\n      <ShowButton />\n    </Datagrid>\n  </List>\n);\n\nexport const UserShow = (props) => (\n  <Show title={<UserTitle />} {...props}>\n    <SimpleShowLayout>\n      <TextField source=\"id\" />\n      <TextField source=\"name\" />\n      <TextField source=\"username\" />\n      <EmailField source=\"email\" />\n    </SimpleShowLayout>\n  </Show>\n);\n"
  },
  {
    "path": "examples/jest-node-fetch/.eslintrc.js",
    "content": "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",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"jest-node-fetch/posts/should return post\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"1.4.1\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"41b7d6ef74440e3b785f1634743f9139\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": [\n                \"*/*\"\n              ]\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": [\n                \"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"\n              ]\n            },\n            {\n              \"name\": \"accept-encoding\",\n              \"value\": [\n                \"gzip,deflate\"\n              ]\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": [\n                \"close\"\n              ]\n            },\n            {\n              \"name\": \"host\",\n              \"value\": \"jsonplaceholder.typicode.com\"\n            }\n          ],\n          \"headersSize\": 228,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"postData\": {\n            \"mimeType\": \"text/plain\"\n          },\n          \"queryString\": [],\n          \"url\": \"https://jsonplaceholder.typicode.com/posts/1\"\n        },\n        \"response\": {\n          \"bodySize\": 408,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 408,\n            \"text\": \"[\\\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\\\"]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-01-10T21:41:12.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"value\": \"d1a5589e8309b42c054255a4709d3a4401547156472\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 10 Jan 2019 21:41:12 GMT\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"transfer-encoding\",\n              \"value\": \"chunked\"\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": \"close\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": [\n                \"__cfduid=d1a5589e8309b42c054255a4709d3a4401547156472; expires=Fri, 10-Jan-20 21:41:12 GMT; path=/; domain=.typicode.com; HttpOnly\"\n              ]\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Fri, 11 Jan 2019 01:41:12 GMT\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"124-yiKdLzqO5gfBrJFrcdJ8Yq0LGnU\\\"\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"49724e71dcd2bca4-SEA\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"gzip\"\n            }\n          ],\n          \"headersSize\": 754,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2019-01-10T21:41:11.992Z\",\n        \"time\": 71,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 71\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/jest-node-fetch/__recordings__/jest-node-fetch_1142061259/users_1585235219/should-return-user_4259424139/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"jest-node-fetch/users/should return user\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"1.4.1\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"902ec6bd7d5925aefdb6e4091e660f11\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": [\n                \"*/*\"\n              ]\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": [\n                \"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"\n              ]\n            },\n            {\n              \"name\": \"accept-encoding\",\n              \"value\": [\n                \"gzip,deflate\"\n              ]\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": [\n                \"close\"\n              ]\n            },\n            {\n              \"name\": \"host\",\n              \"value\": \"jsonplaceholder.typicode.com\"\n            }\n          ],\n          \"headersSize\": 228,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"postData\": {\n            \"mimeType\": \"text/plain\"\n          },\n          \"queryString\": [],\n          \"url\": \"https://jsonplaceholder.typicode.com/users/1\"\n        },\n        \"response\": {\n          \"bodySize\": 662,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 662,\n            \"text\": \"[\\\"1f8b08000000000000034590cd6e83301084ef3cc5cae71a95000172eacf2187a652d53ec1022bb06a6cb4364d9328ef5e61427ab3e6dbf5eccc250210aa153b481ee6a7c181c40ec481d018823d638f83086872c42b7e61f28b4a032a3d4b5fca34c4f484232b1dd7eabc706c5b26e7c40e2e110080709e89fcbcf136697470505dbffc35c349f960f03cfa18f27cbb8246f9d3acef8f646acb76eafa159dd5d8d8366c559baa2a655a16d90a3bb2776b00a13138cbb488d324af6e533330dd0cca244eb26a2b827c8d00ae21c4d85b130c1259148fb248b7b27c4c13f8cdb759b659821ea976b7e37ba55bea90dbd872b7d0c60e239ad37f0d6b939f76c06e2246f9cad6e03d2ffaa6ffe8195d987a9fb45752e389985a68b422e3a523fe21064313a39686ee2dd62e5c816cc83960422dbd1a08480ec8dfe4dd9cef1a5dff006748ce45fd010000\\\"]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-01-10T21:41:12.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"value\": \"d9290fa7f69379aa1374913e89cbc6aaf1547156472\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 10 Jan 2019 21:41:12 GMT\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"transfer-encoding\",\n              \"value\": \"chunked\"\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": \"close\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": [\n                \"__cfduid=d9290fa7f69379aa1374913e89cbc6aaf1547156472; expires=Fri, 10-Jan-20 21:41:12 GMT; path=/; domain=.typicode.com; HttpOnly\"\n              ]\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Fri, 11 Jan 2019 01:41:12 GMT\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"1fd-+2Y3G3w049iSZtw5t1mzSnunngE\\\"\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"49724e721ed0bc98-SEA\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"gzip\"\n            }\n          ],\n          \"headersSize\": 754,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2019-01-10T21:41:12.082Z\",\n        \"time\": 16,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 16\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/jest-node-fetch/__tests__/index.test.js",
    "content": "const path = require('path');\n\nconst { Polly } = require('@pollyjs/core');\nconst { setupPolly } = require('setup-polly-jest');\nconst NodeHttpAdapter = require('@pollyjs/adapter-node-http');\nconst FSPersister = require('@pollyjs/persister-fs');\n\nPolly.register(NodeHttpAdapter);\nPolly.register(FSPersister);\n\nconst { posts, users } = require('../src');\n\ndescribe('jest-node-fetch', () => {\n  setupPolly({\n    adapters: ['node-http'],\n    persister: 'fs',\n    persisterOptions: {\n      fs: {\n        recordingsDir: path.resolve(__dirname, '../__recordings__')\n      }\n    }\n  });\n\n  describe('posts', () => {\n    it('should return post', async () => {\n      const post = await posts('1');\n\n      expect(post.id).toBe(1);\n      expect(post.title).toBe(\n        'sunt aut facere repellat provident occaecati excepturi optio reprehenderit'\n      );\n    });\n  });\n\n  describe('users', () => {\n    it('should return user', async () => {\n      const user = await users('1');\n\n      expect(user.id).toBe(1);\n      expect(user.name).toBe('Leanne Graham');\n      expect(user.email).toBe('Sincere@april.biz');\n    });\n  });\n});\n"
  },
  {
    "path": "examples/jest-node-fetch/package.json",
    "content": "{\n  \"name\": \"@pollyjs/jest-node-fetch-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"test\": \"jest\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-node-http\": \"*\",\n    \"@pollyjs/core\": \"*\",\n    \"@pollyjs/persister-fs\": \"*\",\n    \"jest\": \"*\",\n    \"node-fetch\": \"*\",\n    \"setup-polly-jest\": \"*\"\n  }\n}\n"
  },
  {
    "path": "examples/jest-node-fetch/src/index.js",
    "content": "module.exports = {\n  posts: require('./posts'),\n  users: require('./users')\n};\n"
  },
  {
    "path": "examples/jest-node-fetch/src/posts.js",
    "content": "const fetch = require('node-fetch');\n\nmodule.exports = async (id) => {\n  const response = await fetch(\n    `https://jsonplaceholder.typicode.com/posts/${id}`\n  );\n\n  return await response.json();\n};\n"
  },
  {
    "path": "examples/jest-node-fetch/src/users.js",
    "content": "const fetch = require('node-fetch');\n\nmodule.exports = async (id) => {\n  const response = await fetch(\n    `https://jsonplaceholder.typicode.com/users/${id}`\n  );\n\n  return await response.json();\n};\n"
  },
  {
    "path": "examples/jest-puppeteer/.eslintrc.js",
    "content": "module.exports = {\n  env: {\n    jest: true\n  },\n  globals: {\n    page: true,\n    browser: true,\n    jestPuppeteer: true\n  }\n};\n"
  },
  {
    "path": "examples/jest-puppeteer/__recordings__/jest-puppeteer_2726822272/should-be-able-to-navigate-to-all-routes_1130491217/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"jest-puppeteer/should be able to navigate to all routes\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"4.0.2\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"7a6a80a84887e23d598869aa95e38bd9\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3582.0 Safari/537.36\"\n            }\n          ],\n          \"headersSize\": 322,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [\n            {\n              \"name\": \"_end\",\n              \"value\": \"10\"\n            },\n            {\n              \"name\": \"_order\",\n              \"value\": \"ASC\"\n            },\n            {\n              \"name\": \"_sort\",\n              \"value\": \"title\"\n            },\n            {\n              \"name\": \"_start\",\n              \"value\": \"0\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/posts?_end=10&_order=ASC&_sort=title&_start=0\"\n        },\n        \"response\": {\n          \"bodySize\": 2594,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 2594,\n            \"text\": \"[\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 30,\\n    \\\"title\\\": \\\"a quo magni similique perferendis\\\",\\n    \\\"body\\\": \\\"alias dolor cumque\\\\nimpedit blanditiis non eveniet odio maxime\\\\nblanditiis amet eius quis tempora quia autem rem\\\\na provident perspiciatis quia\\\"\\n  },\\n  {\\n    \\\"userId\\\": 9,\\n    \\\"id\\\": 90,\\n    \\\"title\\\": \\\"ad iusto omnis odit dolor voluptatibus\\\",\\n    \\\"body\\\": \\\"minus omnis soluta quia\\\\nqui sed adipisci voluptates illum ipsam voluptatem\\\\neligendi officia ut in\\\\neos soluta similique molestias praesentium blanditiis\\\"\\n  },\\n  {\\n    \\\"userId\\\": 2,\\n    \\\"id\\\": 19,\\n    \\\"title\\\": \\\"adipisci placeat illum aut reiciendis qui\\\",\\n    \\\"body\\\": \\\"illum quis cupiditate provident sit magnam\\\\nea sed aut omnis\\\\nveniam maiores ullam consequatur atque\\\\nadipisci quo iste expedita sit quos voluptas\\\"\\n  },\\n  {\\n    \\\"userId\\\": 7,\\n    \\\"id\\\": 67,\\n    \\\"title\\\": \\\"aliquid eos sed fuga est maxime repellendus\\\",\\n    \\\"body\\\": \\\"reprehenderit id nostrum\\\\nvoluptas doloremque pariatur sint et accusantium quia quod aspernatur\\\\net fugiat amet\\\\nnon sapiente et consequatur necessitatibus molestiae\\\"\\n  },\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 21,\\n    \\\"title\\\": \\\"asperiores ea ipsam voluptatibus modi minima quia sint\\\",\\n    \\\"body\\\": \\\"repellat aliquid praesentium dolorem quo\\\\nsed totam minus non itaque\\\\nnihil labore molestiae sunt dolor eveniet hic recusandae veniam\\\\ntempora et tenetur expedita sunt\\\"\\n  },\\n  {\\n    \\\"userId\\\": 10,\\n    \\\"id\\\": 100,\\n    \\\"title\\\": \\\"at nam consequatur ea labore ea harum\\\",\\n    \\\"body\\\": \\\"cupiditate quo est a modi nesciunt soluta\\\\nipsa voluptas error itaque dicta in\\\\nautem qui minus magnam et distinctio eum\\\\naccusamus ratione error aut\\\"\\n  },\\n  {\\n    \\\"userId\\\": 10,\\n    \\\"id\\\": 91,\\n    \\\"title\\\": \\\"aut amet sed\\\",\\n    \\\"body\\\": \\\"libero voluptate eveniet aperiam sed\\\\nsunt placeat suscipit molestias\\\\nsimilique fugit nam natus\\\\nexpedita consequatur consequatur dolores quia eos et placeat\\\"\\n  },\\n  {\\n    \\\"userId\\\": 5,\\n    \\\"id\\\": 46,\\n    \\\"title\\\": \\\"aut quo modi neque nostrum ducimus\\\",\\n    \\\"body\\\": \\\"voluptatem quisquam iste\\\\nvoluptatibus natus officiis facilis dolorem\\\\nquis quas ipsam\\\\nvel et voluptatum in aliquid\\\"\\n  },\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 24,\\n    \\\"title\\\": \\\"autem hic labore sunt dolores incidunt\\\",\\n    \\\"body\\\": \\\"enim et ex nulla\\\\nomnis voluptas quia qui\\\\nvoluptatem consequatur numquam aliquam sunt\\\\ntotam recusandae id dignissimos aut sed asperiores deserunt\\\"\\n  },\\n  {\\n    \\\"userId\\\": 7,\\n    \\\"id\\\": 62,\\n    \\\"title\\\": \\\"beatae enim quia vel\\\",\\n    \\\"body\\\": \\\"enim aspernatur illo distinctio quae praesentium\\\\nbeatae alias amet delectus qui voluptate distinctio\\\\nodit sint accusantium autem omnis\\\\nquo molestiae omnis ea eveniet optio\\\"\\n  }\\n]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-02-29T07:09:08.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"sameSite\": \"Lax\",\n              \"value\": \"d42dac9bc17ea4fe874662c606ae95df71580368148\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 30 Jan 2020 07:09:08 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"age\",\n              \"value\": \"3771\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"x-total-count\",\n              \"value\": \"100\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"a22-FI+zdCzw2iL/TSmHe3WZs7jlNFI\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"access-control-expose-headers\",\n              \"value\": \"X-Total-Count\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": \"__cfduid=d42dac9bc17ea4fe874662c606ae95df71580368148; expires=Sat, 29-Feb-20 07:09:08 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"55d19e5cff4293b8-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"-1\"\n            }\n          ],\n          \"headersSize\": 826,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2020-01-30T07:08:19.576Z\",\n        \"time\": 167,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 167\n        }\n      },\n      {\n        \"_id\": \"8ce66159473fb131cc371230c3edcb70\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3582.0 Safari/537.36\"\n            }\n          ],\n          \"headersSize\": 313,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"3\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"9\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"2\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"7\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"10\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"5\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/users?id=3&id=9&id=2&id=7&id=10&id=5\"\n        },\n        \"response\": {\n          \"bodySize\": 3360,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 3360,\n            \"text\": \"[\\n  {\\n    \\\"id\\\": 2,\\n    \\\"name\\\": \\\"Ervin Howell\\\",\\n    \\\"username\\\": \\\"Antonette\\\",\\n    \\\"email\\\": \\\"Shanna@melissa.tv\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Victor Plains\\\",\\n      \\\"suite\\\": \\\"Suite 879\\\",\\n      \\\"city\\\": \\\"Wisokyburgh\\\",\\n      \\\"zipcode\\\": \\\"90566-7771\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-43.9509\\\",\\n        \\\"lng\\\": \\\"-34.4618\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"010-692-6593 x09125\\\",\\n    \\\"website\\\": \\\"anastasia.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Deckow-Crist\\\",\\n      \\\"catchPhrase\\\": \\\"Proactive didactic contingency\\\",\\n      \\\"bs\\\": \\\"synergize scalable supply-chains\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 3,\\n    \\\"name\\\": \\\"Clementine Bauch\\\",\\n    \\\"username\\\": \\\"Samantha\\\",\\n    \\\"email\\\": \\\"Nathan@yesenia.net\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Douglas Extension\\\",\\n      \\\"suite\\\": \\\"Suite 847\\\",\\n      \\\"city\\\": \\\"McKenziehaven\\\",\\n      \\\"zipcode\\\": \\\"59590-4157\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-68.6102\\\",\\n        \\\"lng\\\": \\\"-47.0653\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-463-123-4447\\\",\\n    \\\"website\\\": \\\"ramiro.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Jacobson\\\",\\n      \\\"catchPhrase\\\": \\\"Face to face bifurcated interface\\\",\\n      \\\"bs\\\": \\\"e-enable strategic applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 5,\\n    \\\"name\\\": \\\"Chelsey Dietrich\\\",\\n    \\\"username\\\": \\\"Kamren\\\",\\n    \\\"email\\\": \\\"Lucio_Hettinger@annie.ca\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Skiles Walks\\\",\\n      \\\"suite\\\": \\\"Suite 351\\\",\\n      \\\"city\\\": \\\"Roscoeview\\\",\\n      \\\"zipcode\\\": \\\"33263\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-31.8129\\\",\\n        \\\"lng\\\": \\\"62.5342\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(254)954-1289\\\",\\n    \\\"website\\\": \\\"demarco.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Keebler LLC\\\",\\n      \\\"catchPhrase\\\": \\\"User-centric fault-tolerant solution\\\",\\n      \\\"bs\\\": \\\"revolutionize end-to-end systems\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 7,\\n    \\\"name\\\": \\\"Kurtis Weissnat\\\",\\n    \\\"username\\\": \\\"Elwyn.Skiles\\\",\\n    \\\"email\\\": \\\"Telly.Hoeger@billy.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Rex Trail\\\",\\n      \\\"suite\\\": \\\"Suite 280\\\",\\n      \\\"city\\\": \\\"Howemouth\\\",\\n      \\\"zipcode\\\": \\\"58804-1099\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.8918\\\",\\n        \\\"lng\\\": \\\"21.8984\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"210.067.6132\\\",\\n    \\\"website\\\": \\\"elvis.io\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Johns Group\\\",\\n      \\\"catchPhrase\\\": \\\"Configurable multimedia task-force\\\",\\n      \\\"bs\\\": \\\"generate enterprise e-tailers\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 9,\\n    \\\"name\\\": \\\"Glenna Reichert\\\",\\n    \\\"username\\\": \\\"Delphine\\\",\\n    \\\"email\\\": \\\"Chaim_McDermott@dana.io\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Dayna Park\\\",\\n      \\\"suite\\\": \\\"Suite 449\\\",\\n      \\\"city\\\": \\\"Bartholomebury\\\",\\n      \\\"zipcode\\\": \\\"76495-3109\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.6463\\\",\\n        \\\"lng\\\": \\\"-168.8889\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(775)976-6794 x41206\\\",\\n    \\\"website\\\": \\\"conrad.com\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Yost and Sons\\\",\\n      \\\"catchPhrase\\\": \\\"Switchable contextually-based project\\\",\\n      \\\"bs\\\": \\\"aggregate real-time technologies\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 10,\\n    \\\"name\\\": \\\"Clementina DuBuque\\\",\\n    \\\"username\\\": \\\"Moriah.Stanton\\\",\\n    \\\"email\\\": \\\"Rey.Padberg@karina.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kattie Turnpike\\\",\\n      \\\"suite\\\": \\\"Suite 198\\\",\\n      \\\"city\\\": \\\"Lebsackbury\\\",\\n      \\\"zipcode\\\": \\\"31428-2261\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-38.2386\\\",\\n        \\\"lng\\\": \\\"57.2232\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"024-648-3804\\\",\\n    \\\"website\\\": \\\"ambrose.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Hoeger LLC\\\",\\n      \\\"catchPhrase\\\": \\\"Centralized empowering task-force\\\",\\n      \\\"bs\\\": \\\"target end-to-end models\\\"\\n    }\\n  }\\n]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-02-29T07:09:08.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"sameSite\": \"Lax\",\n              \"value\": \"d42dac9bc17ea4fe874662c606ae95df71580368148\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 30 Jan 2020 07:09:08 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"age\",\n              \"value\": \"3770\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"d20-ZHlyCzvRVweI5qleuamBhoeSO1g\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": \"__cfduid=d42dac9bc17ea4fe874662c606ae95df71580368148; expires=Sat, 29-Feb-20 07:09:08 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"55d19e5f180293b8-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"-1\"\n            }\n          ],\n          \"headersSize\": 760,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2020-01-30T07:08:20.026Z\",\n        \"time\": 63,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 63\n        }\n      },\n      {\n        \"_id\": \"077d0227d1c3015cc550180e38a7a324\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3582.0 Safari/537.36\"\n            }\n          ],\n          \"headersSize\": 322,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [\n            {\n              \"name\": \"_end\",\n              \"value\": \"10\"\n            },\n            {\n              \"name\": \"_order\",\n              \"value\": \"ASC\"\n            },\n            {\n              \"name\": \"_sort\",\n              \"value\": \"title\"\n            },\n            {\n              \"name\": \"_start\",\n              \"value\": \"0\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/todos?_end=10&_order=ASC&_sort=title&_start=0\"\n        },\n        \"response\": {\n          \"bodySize\": 1238,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 1238,\n            \"text\": \"[\\n  {\\n    \\\"userId\\\": 6,\\n    \\\"id\\\": 108,\\n    \\\"title\\\": \\\"a eos eaque nihil et exercitationem incidunt delectus\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 1,\\n    \\\"id\\\": 15,\\n    \\\"title\\\": \\\"ab voluptatum amet voluptas\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 8,\\n    \\\"id\\\": 151,\\n    \\\"title\\\": \\\"accusamus adipisci dicta qui quo ea explicabo sed vero\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 1,\\n    \\\"id\\\": 16,\\n    \\\"title\\\": \\\"accusamus eos facilis sint et aut voluptatem\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 10,\\n    \\\"id\\\": 190,\\n    \\\"title\\\": \\\"accusamus sint iusto et voluptatem exercitationem\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 6,\\n    \\\"id\\\": 106,\\n    \\\"title\\\": \\\"ad illo quis voluptatem temporibus\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 2,\\n    \\\"id\\\": 24,\\n    \\\"title\\\": \\\"adipisci non ad dicta qui amet quaerat doloribus ea\\\",\\n    \\\"completed\\\": false\\n  },\\n  {\\n    \\\"userId\\\": 2,\\n    \\\"id\\\": 26,\\n    \\\"title\\\": \\\"aliquam aut quasi\\\",\\n    \\\"completed\\\": true\\n  },\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 41,\\n    \\\"title\\\": \\\"aliquid amet impedit consequatur aspernatur placeat eaque fugiat suscipit\\\",\\n    \\\"completed\\\": false\\n  },\\n  {\\n    \\\"userId\\\": 8,\\n    \\\"id\\\": 149,\\n    \\\"title\\\": \\\"animi voluptas quod perferendis est\\\",\\n    \\\"completed\\\": false\\n  }\\n]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-02-29T07:09:09.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"sameSite\": \"Lax\",\n              \"value\": \"db5bbdd08302e4f111266efd1f3fd3dd51580368149\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 30 Jan 2020 07:09:09 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"age\",\n              \"value\": \"3769\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"x-total-count\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"4d6-FQWFhszsnTQKj5DCOASvDSlF2No\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"access-control-expose-headers\",\n              \"value\": \"X-Total-Count\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": \"__cfduid=db5bbdd08302e4f111266efd1f3fd3dd51580368149; expires=Sat, 29-Feb-20 07:09:09 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"55d19e644a2e93b8-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"-1\"\n            }\n          ],\n          \"headersSize\": 826,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2020-01-30T07:08:20.861Z\",\n        \"time\": 367,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 367\n        }\n      },\n      {\n        \"_id\": \"d38053106b03f35c571f5664ed50ad06\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3582.0 Safari/537.36\"\n            }\n          ],\n          \"headersSize\": 321,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [\n            {\n              \"name\": \"_end\",\n              \"value\": \"10\"\n            },\n            {\n              \"name\": \"_order\",\n              \"value\": \"ASC\"\n            },\n            {\n              \"name\": \"_sort\",\n              \"value\": \"name\"\n            },\n            {\n              \"name\": \"_start\",\n              \"value\": \"0\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/users?_end=10&_order=ASC&_sort=name&_start=0\"\n        },\n        \"response\": {\n          \"bodySize\": 5645,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 5645,\n            \"text\": \"[\\n  {\\n    \\\"id\\\": 5,\\n    \\\"name\\\": \\\"Chelsey Dietrich\\\",\\n    \\\"username\\\": \\\"Kamren\\\",\\n    \\\"email\\\": \\\"Lucio_Hettinger@annie.ca\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Skiles Walks\\\",\\n      \\\"suite\\\": \\\"Suite 351\\\",\\n      \\\"city\\\": \\\"Roscoeview\\\",\\n      \\\"zipcode\\\": \\\"33263\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-31.8129\\\",\\n        \\\"lng\\\": \\\"62.5342\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(254)954-1289\\\",\\n    \\\"website\\\": \\\"demarco.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Keebler LLC\\\",\\n      \\\"catchPhrase\\\": \\\"User-centric fault-tolerant solution\\\",\\n      \\\"bs\\\": \\\"revolutionize end-to-end systems\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 10,\\n    \\\"name\\\": \\\"Clementina DuBuque\\\",\\n    \\\"username\\\": \\\"Moriah.Stanton\\\",\\n    \\\"email\\\": \\\"Rey.Padberg@karina.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kattie Turnpike\\\",\\n      \\\"suite\\\": \\\"Suite 198\\\",\\n      \\\"city\\\": \\\"Lebsackbury\\\",\\n      \\\"zipcode\\\": \\\"31428-2261\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-38.2386\\\",\\n        \\\"lng\\\": \\\"57.2232\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"024-648-3804\\\",\\n    \\\"website\\\": \\\"ambrose.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Hoeger LLC\\\",\\n      \\\"catchPhrase\\\": \\\"Centralized empowering task-force\\\",\\n      \\\"bs\\\": \\\"target end-to-end models\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 3,\\n    \\\"name\\\": \\\"Clementine Bauch\\\",\\n    \\\"username\\\": \\\"Samantha\\\",\\n    \\\"email\\\": \\\"Nathan@yesenia.net\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Douglas Extension\\\",\\n      \\\"suite\\\": \\\"Suite 847\\\",\\n      \\\"city\\\": \\\"McKenziehaven\\\",\\n      \\\"zipcode\\\": \\\"59590-4157\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-68.6102\\\",\\n        \\\"lng\\\": \\\"-47.0653\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-463-123-4447\\\",\\n    \\\"website\\\": \\\"ramiro.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Jacobson\\\",\\n      \\\"catchPhrase\\\": \\\"Face to face bifurcated interface\\\",\\n      \\\"bs\\\": \\\"e-enable strategic applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 2,\\n    \\\"name\\\": \\\"Ervin Howell\\\",\\n    \\\"username\\\": \\\"Antonette\\\",\\n    \\\"email\\\": \\\"Shanna@melissa.tv\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Victor Plains\\\",\\n      \\\"suite\\\": \\\"Suite 879\\\",\\n      \\\"city\\\": \\\"Wisokyburgh\\\",\\n      \\\"zipcode\\\": \\\"90566-7771\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-43.9509\\\",\\n        \\\"lng\\\": \\\"-34.4618\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"010-692-6593 x09125\\\",\\n    \\\"website\\\": \\\"anastasia.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Deckow-Crist\\\",\\n      \\\"catchPhrase\\\": \\\"Proactive didactic contingency\\\",\\n      \\\"bs\\\": \\\"synergize scalable supply-chains\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 9,\\n    \\\"name\\\": \\\"Glenna Reichert\\\",\\n    \\\"username\\\": \\\"Delphine\\\",\\n    \\\"email\\\": \\\"Chaim_McDermott@dana.io\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Dayna Park\\\",\\n      \\\"suite\\\": \\\"Suite 449\\\",\\n      \\\"city\\\": \\\"Bartholomebury\\\",\\n      \\\"zipcode\\\": \\\"76495-3109\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.6463\\\",\\n        \\\"lng\\\": \\\"-168.8889\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(775)976-6794 x41206\\\",\\n    \\\"website\\\": \\\"conrad.com\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Yost and Sons\\\",\\n      \\\"catchPhrase\\\": \\\"Switchable contextually-based project\\\",\\n      \\\"bs\\\": \\\"aggregate real-time technologies\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 7,\\n    \\\"name\\\": \\\"Kurtis Weissnat\\\",\\n    \\\"username\\\": \\\"Elwyn.Skiles\\\",\\n    \\\"email\\\": \\\"Telly.Hoeger@billy.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Rex Trail\\\",\\n      \\\"suite\\\": \\\"Suite 280\\\",\\n      \\\"city\\\": \\\"Howemouth\\\",\\n      \\\"zipcode\\\": \\\"58804-1099\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.8918\\\",\\n        \\\"lng\\\": \\\"21.8984\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"210.067.6132\\\",\\n    \\\"website\\\": \\\"elvis.io\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Johns Group\\\",\\n      \\\"catchPhrase\\\": \\\"Configurable multimedia task-force\\\",\\n      \\\"bs\\\": \\\"generate enterprise e-tailers\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 1,\\n    \\\"name\\\": \\\"Leanne Graham\\\",\\n    \\\"username\\\": \\\"Bret\\\",\\n    \\\"email\\\": \\\"Sincere@april.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kulas Light\\\",\\n      \\\"suite\\\": \\\"Apt. 556\\\",\\n      \\\"city\\\": \\\"Gwenborough\\\",\\n      \\\"zipcode\\\": \\\"92998-3874\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-37.3159\\\",\\n        \\\"lng\\\": \\\"81.1496\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-770-736-8031 x56442\\\",\\n    \\\"website\\\": \\\"hildegard.org\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Crona\\\",\\n      \\\"catchPhrase\\\": \\\"Multi-layered client-server neural-net\\\",\\n      \\\"bs\\\": \\\"harness real-time e-markets\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 6,\\n    \\\"name\\\": \\\"Mrs. Dennis Schulist\\\",\\n    \\\"username\\\": \\\"Leopoldo_Corkery\\\",\\n    \\\"email\\\": \\\"Karley_Dach@jasper.info\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Norberto Crossing\\\",\\n      \\\"suite\\\": \\\"Apt. 950\\\",\\n      \\\"city\\\": \\\"South Christy\\\",\\n      \\\"zipcode\\\": \\\"23505-1337\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-71.4197\\\",\\n        \\\"lng\\\": \\\"71.7478\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-477-935-8478 x6430\\\",\\n    \\\"website\\\": \\\"ola.org\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Considine-Lockman\\\",\\n      \\\"catchPhrase\\\": \\\"Synchronised bottom-line interface\\\",\\n      \\\"bs\\\": \\\"e-enable innovative applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 8,\\n    \\\"name\\\": \\\"Nicholas Runolfsdottir V\\\",\\n    \\\"username\\\": \\\"Maxime_Nienow\\\",\\n    \\\"email\\\": \\\"Sherwood@rosamond.me\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Ellsworth Summit\\\",\\n      \\\"suite\\\": \\\"Suite 729\\\",\\n      \\\"city\\\": \\\"Aliyaview\\\",\\n      \\\"zipcode\\\": \\\"45169\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-14.3990\\\",\\n        \\\"lng\\\": \\\"-120.7677\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"586.493.6943 x140\\\",\\n    \\\"website\\\": \\\"jacynthe.com\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Abernathy Group\\\",\\n      \\\"catchPhrase\\\": \\\"Implemented secondary concept\\\",\\n      \\\"bs\\\": \\\"e-enable extensible e-tailers\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 4,\\n    \\\"name\\\": \\\"Patricia Lebsack\\\",\\n    \\\"username\\\": \\\"Karianne\\\",\\n    \\\"email\\\": \\\"Julianne.OConner@kory.org\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Hoeger Mall\\\",\\n      \\\"suite\\\": \\\"Apt. 692\\\",\\n      \\\"city\\\": \\\"South Elvis\\\",\\n      \\\"zipcode\\\": \\\"53919-4257\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"29.4572\\\",\\n        \\\"lng\\\": \\\"-164.2990\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"493-170-9623 x156\\\",\\n    \\\"website\\\": \\\"kale.biz\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Robel-Corkery\\\",\\n      \\\"catchPhrase\\\": \\\"Multi-tiered zero tolerance productivity\\\",\\n      \\\"bs\\\": \\\"transition cutting-edge web services\\\"\\n    }\\n  }\\n]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-02-29T07:09:09.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"sameSite\": \"Lax\",\n              \"value\": \"db5bbdd08302e4f111266efd1f3fd3dd51580368149\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 30 Jan 2020 07:09:09 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"age\",\n              \"value\": \"3769\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"x-total-count\",\n              \"value\": \"10\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"160d-effcizVuOlMD7nsyxg4tYeQ+hLc\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"access-control-expose-headers\",\n              \"value\": \"X-Total-Count\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": \"__cfduid=db5bbdd08302e4f111266efd1f3fd3dd51580368149; expires=Sat, 29-Feb-20 07:09:09 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"55d19e667b0b93b8-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"-1\"\n            }\n          ],\n          \"headersSize\": 826,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2020-01-30T07:08:21.162Z\",\n        \"time\": 139,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 139\n        }\n      },\n      {\n        \"_id\": \"d7b612efe837babe49ce9ba652d3b68b\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/72.0.3582.0 Safari/537.36\"\n            }\n          ],\n          \"headersSize\": 321,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"6\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"1\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"8\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"10\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"2\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"id\",\n              \"value\": \"3\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/users?id=6&id=1&id=8&id=10&id=2&id=3\"\n        },\n        \"response\": {\n          \"bodySize\": 3398,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 3398,\n            \"text\": \"[\\n  {\\n    \\\"id\\\": 1,\\n    \\\"name\\\": \\\"Leanne Graham\\\",\\n    \\\"username\\\": \\\"Bret\\\",\\n    \\\"email\\\": \\\"Sincere@april.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kulas Light\\\",\\n      \\\"suite\\\": \\\"Apt. 556\\\",\\n      \\\"city\\\": \\\"Gwenborough\\\",\\n      \\\"zipcode\\\": \\\"92998-3874\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-37.3159\\\",\\n        \\\"lng\\\": \\\"81.1496\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-770-736-8031 x56442\\\",\\n    \\\"website\\\": \\\"hildegard.org\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Crona\\\",\\n      \\\"catchPhrase\\\": \\\"Multi-layered client-server neural-net\\\",\\n      \\\"bs\\\": \\\"harness real-time e-markets\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 2,\\n    \\\"name\\\": \\\"Ervin Howell\\\",\\n    \\\"username\\\": \\\"Antonette\\\",\\n    \\\"email\\\": \\\"Shanna@melissa.tv\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Victor Plains\\\",\\n      \\\"suite\\\": \\\"Suite 879\\\",\\n      \\\"city\\\": \\\"Wisokyburgh\\\",\\n      \\\"zipcode\\\": \\\"90566-7771\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-43.9509\\\",\\n        \\\"lng\\\": \\\"-34.4618\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"010-692-6593 x09125\\\",\\n    \\\"website\\\": \\\"anastasia.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Deckow-Crist\\\",\\n      \\\"catchPhrase\\\": \\\"Proactive didactic contingency\\\",\\n      \\\"bs\\\": \\\"synergize scalable supply-chains\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 3,\\n    \\\"name\\\": \\\"Clementine Bauch\\\",\\n    \\\"username\\\": \\\"Samantha\\\",\\n    \\\"email\\\": \\\"Nathan@yesenia.net\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Douglas Extension\\\",\\n      \\\"suite\\\": \\\"Suite 847\\\",\\n      \\\"city\\\": \\\"McKenziehaven\\\",\\n      \\\"zipcode\\\": \\\"59590-4157\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-68.6102\\\",\\n        \\\"lng\\\": \\\"-47.0653\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-463-123-4447\\\",\\n    \\\"website\\\": \\\"ramiro.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Jacobson\\\",\\n      \\\"catchPhrase\\\": \\\"Face to face bifurcated interface\\\",\\n      \\\"bs\\\": \\\"e-enable strategic applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 6,\\n    \\\"name\\\": \\\"Mrs. Dennis Schulist\\\",\\n    \\\"username\\\": \\\"Leopoldo_Corkery\\\",\\n    \\\"email\\\": \\\"Karley_Dach@jasper.info\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Norberto Crossing\\\",\\n      \\\"suite\\\": \\\"Apt. 950\\\",\\n      \\\"city\\\": \\\"South Christy\\\",\\n      \\\"zipcode\\\": \\\"23505-1337\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-71.4197\\\",\\n        \\\"lng\\\": \\\"71.7478\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-477-935-8478 x6430\\\",\\n    \\\"website\\\": \\\"ola.org\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Considine-Lockman\\\",\\n      \\\"catchPhrase\\\": \\\"Synchronised bottom-line interface\\\",\\n      \\\"bs\\\": \\\"e-enable innovative applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 8,\\n    \\\"name\\\": \\\"Nicholas Runolfsdottir V\\\",\\n    \\\"username\\\": \\\"Maxime_Nienow\\\",\\n    \\\"email\\\": \\\"Sherwood@rosamond.me\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Ellsworth Summit\\\",\\n      \\\"suite\\\": \\\"Suite 729\\\",\\n      \\\"city\\\": \\\"Aliyaview\\\",\\n      \\\"zipcode\\\": \\\"45169\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-14.3990\\\",\\n        \\\"lng\\\": \\\"-120.7677\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"586.493.6943 x140\\\",\\n    \\\"website\\\": \\\"jacynthe.com\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Abernathy Group\\\",\\n      \\\"catchPhrase\\\": \\\"Implemented secondary concept\\\",\\n      \\\"bs\\\": \\\"e-enable extensible e-tailers\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 10,\\n    \\\"name\\\": \\\"Clementina DuBuque\\\",\\n    \\\"username\\\": \\\"Moriah.Stanton\\\",\\n    \\\"email\\\": \\\"Rey.Padberg@karina.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kattie Turnpike\\\",\\n      \\\"suite\\\": \\\"Suite 198\\\",\\n      \\\"city\\\": \\\"Lebsackbury\\\",\\n      \\\"zipcode\\\": \\\"31428-2261\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-38.2386\\\",\\n        \\\"lng\\\": \\\"57.2232\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"024-648-3804\\\",\\n    \\\"website\\\": \\\"ambrose.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Hoeger LLC\\\",\\n      \\\"catchPhrase\\\": \\\"Centralized empowering task-force\\\",\\n      \\\"bs\\\": \\\"target end-to-end models\\\"\\n    }\\n  }\\n]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2020-02-29T07:09:29.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"sameSite\": \"Lax\",\n              \"value\": \"dc75f0cde25965ab36ea21361cdb3cf8e1580368169\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 30 Jan 2020 07:09:29 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"age\",\n              \"value\": \"147\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"d46-IDCKT5ms1IwADCSNWe91qzz7vsQ\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": \"__cfduid=dc75f0cde25965ab36ea21361cdb3cf8e1580368169; expires=Sat, 29-Feb-20 07:09:29 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"55d19ee43862937c-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"-1\"\n            }\n          ],\n          \"headersSize\": 759,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2020-01-30T07:08:40.845Z\",\n        \"time\": 629,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 629\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/jest-puppeteer/__tests__/dummy-app.test.js",
    "content": "const path = require('path');\n\nconst { Polly } = require('@pollyjs/core');\nconst { setupPolly } = require('setup-polly-jest');\nconst PuppeteerAdapter = require('@pollyjs/adapter-puppeteer');\nconst FSPersister = require('@pollyjs/persister-fs');\n\nPolly.register(PuppeteerAdapter);\nPolly.register(FSPersister);\n\ndescribe('jest-puppeteer', () => {\n  // NOTE: `context.polly` is not accessible until the jasmine/jest hook `before`\n  // is called. This means it's not accessible in the same tick here. Worth mentioning\n  // since it trolled me while debugging.\n  const context = setupPolly({\n    adapters: ['puppeteer'],\n    // NOTE: `page` is set by jest.config.js preset \"jest-puppeteer\"\n    adapterOptions: { puppeteer: { page } },\n    persister: 'fs',\n    persisterOptions: {\n      fs: {\n        recordingsDir: path.resolve(__dirname, '../__recordings__')\n      }\n    },\n    matchRequestsBy: {\n      headers: {\n        exclude: ['user-agent']\n      }\n    }\n  });\n\n  beforeEach(async () => {\n    jest.setTimeout(60000);\n\n    await page.setRequestInterception(true);\n\n    const { server } = context.polly;\n\n    server.host('http://localhost:3000', () => {\n      server.get('/sockjs-node/*').intercept((_, res) => res.sendStatus(200));\n    });\n\n    await page.goto('http://localhost:3000', { waitUntil: 'networkidle0' });\n  });\n\n  it('should be able to navigate to all routes', async () => {\n    const header = await page.$('header');\n\n    await expect(page).toMatchElement('tbody > tr', { timeout: 5000 });\n    await expect(header).toMatch('Posts');\n\n    await expect(page).toClick('a', { text: 'Todos' });\n    await expect(page).toMatchElement('tbody > tr', { timeout: 5000 });\n    await expect(header).toMatch('Todos');\n\n    await expect(page).toClick('a', { text: 'Users' });\n    await expect(page).toMatchElement('tbody > tr', { timeout: 5000 });\n    await expect(header).toMatch('Users');\n\n    // Wait for all requests to resolve, this can also be replaced with\n    await context.polly.flush();\n  });\n});\n"
  },
  {
    "path": "examples/jest-puppeteer/jest-puppeteer.config.js",
    "content": "module.exports = {\n  launch: {\n    headless: true\n  },\n  server: {\n    command: '(cd ../dummy-app && yarn start:ci)',\n    port: 3000,\n    launchTimeout: 60000\n  }\n};\n"
  },
  {
    "path": "examples/jest-puppeteer/jest.config.js",
    "content": "module.exports = {\n  preset: 'jest-puppeteer'\n};\n"
  },
  {
    "path": "examples/jest-puppeteer/package.json",
    "content": "{\n  \"name\": \"@pollyjs/jest-puppeteer-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"postinstall\": \"(cd ../dummy-app && yarn install)\",\n    \"test\": \"jest\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-puppeteer\": \"^4.0.2\",\n    \"@pollyjs/core\": \"^4.0.2\",\n    \"@pollyjs/persister-fs\": \"^4.0.2\",\n    \"jest\": \"^24.0.0\",\n    \"jest-puppeteer\": \"^4.0.0\",\n    \"puppeteer\": \"1.10.0\",\n    \"setup-polly-jest\": \"^0.6.0\"\n  }\n}\n"
  },
  {
    "path": "examples/node-fetch/package.json",
    "content": "{\n  \"name\": \"@pollyjs/node-fetch-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"test\": \"mocha './tests/*.test.js'\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-node-http\": \"*\",\n    \"@pollyjs/core\": \"*\",\n    \"@pollyjs/persister-fs\": \"*\",\n    \"chai\": \"*\",\n    \"mocha\": \"*\",\n    \"node-fetch\": \"*\"\n  }\n}\n"
  },
  {
    "path": "examples/node-fetch/recordings/node-fetch_2851505768/should-work_3457346403/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"node-fetch/should work\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"1.2.0\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"41b7d6ef74440e3b785f1634743f9139\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": [\n                \"*/*\"\n              ]\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": [\n                \"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"\n              ]\n            },\n            {\n              \"name\": \"accept-encoding\",\n              \"value\": [\n                \"gzip,deflate\"\n              ]\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": [\n                \"close\"\n              ]\n            },\n            {\n              \"name\": \"host\",\n              \"value\": \"jsonplaceholder.typicode.com\"\n            }\n          ],\n          \"headersSize\": 228,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"postData\": {\n            \"mimeType\": \"text/plain\"\n          },\n          \"queryString\": [],\n          \"url\": \"https://jsonplaceholder.typicode.com/posts/1\"\n        },\n        \"response\": {\n          \"bodySize\": 408,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 408,\n            \"text\": \"[\\\"1f8b0800000000000003558f4b6a04410c43f7730a51eb6cb29d1be40ebd715c0a63e8fa8ccb1e2684dc3d744308012324901fe8eb02945cf4b75aae787d39a2fdd9b0d859ae282b7b4032f0214a279c93fb2e81e9e361953d3054852a61e0533923dd3066d838cace1b7ba55b9413fc3eeae7c1bda7091858b9d4a6c5d67f1d9c9a4b7a1542475fbc67f648079f93d5e27cd36c5bff87471b3b57981019c7dd53166284b4adf7b1c2b3c17928d739890de73a67031fecc680b8de2ca831cae5fb0715c693e824010000\\\"]\"\n          },\n          \"cookies\": [\n            {\n              \"domain\": \".typicode.com\",\n              \"expires\": \"2019-12-06T20:53:26.000Z\",\n              \"httpOnly\": true,\n              \"name\": \"__cfduid\",\n              \"path\": \"/\",\n              \"value\": \"d9a2a8da0fc8bad42e47cee6b6782bb811544129606\"\n            }\n          ],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Thu, 06 Dec 2018 20:53:26 GMT\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"transfer-encoding\",\n              \"value\": \"chunked\"\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": \"close\"\n            },\n            {\n              \"name\": \"set-cookie\",\n              \"value\": [\n                \"__cfduid=d9a2a8da0fc8bad42e47cee6b6782bb811544129606; expires=Fri, 06-Dec-19 20:53:26 GMT; path=/; domain=.typicode.com; HttpOnly\"\n              ]\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Fri, 07 Dec 2018 00:53:26 GMT\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"124-yiKdLzqO5gfBrJFrcdJ8Yq0LGnU\\\"\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"4851a4585a759354-SJC\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"gzip\"\n            }\n          ],\n          \"headersSize\": 754,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-12-06T20:53:21.087Z\",\n        \"time\": 130,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 130\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/node-fetch/tests/node-fetch.test.js",
    "content": "const path = require('path');\n\nconst NodeHttpAdapter = require('@pollyjs/adapter-node-http');\nconst FSPersister = require('@pollyjs/persister-fs');\nconst fetch = require('node-fetch');\nconst { Polly, setupMocha: setupPolly } = require('@pollyjs/core');\nconst { expect } = require('chai');\n\nPolly.register(NodeHttpAdapter);\nPolly.register(FSPersister);\n\ndescribe('node-fetch', function () {\n  setupPolly({\n    adapters: ['node-http'],\n    persister: 'fs',\n    persisterOptions: {\n      fs: {\n        recordingsDir: path.resolve(__dirname, '../recordings')\n      }\n    }\n  });\n\n  it('should work', async function () {\n    const res = await fetch('https://jsonplaceholder.typicode.com/posts/1');\n    const post = await res.json();\n\n    expect(res.status).to.equal(200);\n    expect(post.id).to.equal(1);\n  });\n});\n"
  },
  {
    "path": "examples/puppeteer/index.js",
    "content": "const path = require('path');\n\nconst puppeteer = require('puppeteer');\nconst { Polly } = require('@pollyjs/core');\nconst PuppeteerAdapter = require('@pollyjs/adapter-puppeteer');\nconst FSPersister = require('@pollyjs/persister-fs');\n\nPolly.register(PuppeteerAdapter);\nPolly.register(FSPersister);\n\n(async () => {\n  const browser = await puppeteer.launch({ headless: false });\n  const page = await browser.newPage();\n\n  await page.setRequestInterception(true);\n\n  const polly = new Polly('puppeteer', {\n    adapters: ['puppeteer'],\n    adapterOptions: { puppeteer: { page } },\n    persister: 'fs',\n    persisterOptions: {\n      fs: {\n        recordingsDir: path.join(__dirname, 'recordings')\n      }\n    }\n  });\n\n  const { server } = polly;\n\n  server.host('http://localhost:3000', () => {\n    server.get('/favicon.ico').passthrough();\n    server.get('/sockjs-node/*').intercept((_, res) => res.sendStatus(200));\n  });\n\n  await page.goto('http://localhost:3000', { waitUntil: 'networkidle0' });\n\n  await polly.flush();\n  await polly.stop();\n  await browser.close();\n})();\n"
  },
  {
    "path": "examples/puppeteer/package.json",
    "content": "{\n  \"name\": \"@pollyjs/puppeteer-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"postinstall\": \"(cd ../dummy-app && yarn install)\",\n    \"start\": \"start-server-and-test start:server http://localhost:3000 start:puppeteer\",\n    \"start:server\": \"(cd ../dummy-app && yarn start:ci)\",\n    \"start:puppeteer\": \"node index.js\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-puppeteer\": \"*\",\n    \"@pollyjs/core\": \"*\",\n    \"@pollyjs/persister-fs\": \"*\",\n    \"puppeteer\": \"*\",\n    \"start-server-and-test\": \"*\"\n  }\n}\n"
  },
  {
    "path": "examples/puppeteer/recordings/puppeteer_2155046665/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"puppeteer\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"1.2.0\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"6d6504c5ff77bd0d42862429f4c1312c\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3542.0 Safari/537.36\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"headersSize\": 354,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"postData\": {\n            \"mimeType\": \"application/json\"\n          },\n          \"queryString\": [\n            {\n              \"name\": \"_end\",\n              \"value\": \"10\"\n            },\n            {\n              \"name\": \"_order\",\n              \"value\": \"ASC\"\n            },\n            {\n              \"name\": \"_sort\",\n              \"value\": \"title\"\n            },\n            {\n              \"name\": \"_start\",\n              \"value\": \"0\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/posts?_end=10&_order=ASC&_sort=title&_start=0\"\n        },\n        \"response\": {\n          \"bodySize\": 2594,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 2594,\n            \"text\": \"[\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 30,\\n    \\\"title\\\": \\\"a quo magni similique perferendis\\\",\\n    \\\"body\\\": \\\"alias dolor cumque\\\\nimpedit blanditiis non eveniet odio maxime\\\\nblanditiis amet eius quis tempora quia autem rem\\\\na provident perspiciatis quia\\\"\\n  },\\n  {\\n    \\\"userId\\\": 9,\\n    \\\"id\\\": 90,\\n    \\\"title\\\": \\\"ad iusto omnis odit dolor voluptatibus\\\",\\n    \\\"body\\\": \\\"minus omnis soluta quia\\\\nqui sed adipisci voluptates illum ipsam voluptatem\\\\neligendi officia ut in\\\\neos soluta similique molestias praesentium blanditiis\\\"\\n  },\\n  {\\n    \\\"userId\\\": 2,\\n    \\\"id\\\": 19,\\n    \\\"title\\\": \\\"adipisci placeat illum aut reiciendis qui\\\",\\n    \\\"body\\\": \\\"illum quis cupiditate provident sit magnam\\\\nea sed aut omnis\\\\nveniam maiores ullam consequatur atque\\\\nadipisci quo iste expedita sit quos voluptas\\\"\\n  },\\n  {\\n    \\\"userId\\\": 7,\\n    \\\"id\\\": 67,\\n    \\\"title\\\": \\\"aliquid eos sed fuga est maxime repellendus\\\",\\n    \\\"body\\\": \\\"reprehenderit id nostrum\\\\nvoluptas doloremque pariatur sint et accusantium quia quod aspernatur\\\\net fugiat amet\\\\nnon sapiente et consequatur necessitatibus molestiae\\\"\\n  },\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 21,\\n    \\\"title\\\": \\\"asperiores ea ipsam voluptatibus modi minima quia sint\\\",\\n    \\\"body\\\": \\\"repellat aliquid praesentium dolorem quo\\\\nsed totam minus non itaque\\\\nnihil labore molestiae sunt dolor eveniet hic recusandae veniam\\\\ntempora et tenetur expedita sunt\\\"\\n  },\\n  {\\n    \\\"userId\\\": 10,\\n    \\\"id\\\": 100,\\n    \\\"title\\\": \\\"at nam consequatur ea labore ea harum\\\",\\n    \\\"body\\\": \\\"cupiditate quo est a modi nesciunt soluta\\\\nipsa voluptas error itaque dicta in\\\\nautem qui minus magnam et distinctio eum\\\\naccusamus ratione error aut\\\"\\n  },\\n  {\\n    \\\"userId\\\": 10,\\n    \\\"id\\\": 91,\\n    \\\"title\\\": \\\"aut amet sed\\\",\\n    \\\"body\\\": \\\"libero voluptate eveniet aperiam sed\\\\nsunt placeat suscipit molestias\\\\nsimilique fugit nam natus\\\\nexpedita consequatur consequatur dolores quia eos et placeat\\\"\\n  },\\n  {\\n    \\\"userId\\\": 5,\\n    \\\"id\\\": 46,\\n    \\\"title\\\": \\\"aut quo modi neque nostrum ducimus\\\",\\n    \\\"body\\\": \\\"voluptatem quisquam iste\\\\nvoluptatibus natus officiis facilis dolorem\\\\nquis quas ipsam\\\\nvel et voluptatum in aliquid\\\"\\n  },\\n  {\\n    \\\"userId\\\": 3,\\n    \\\"id\\\": 24,\\n    \\\"title\\\": \\\"autem hic labore sunt dolores incidunt\\\",\\n    \\\"body\\\": \\\"enim et ex nulla\\\\nomnis voluptas quia qui\\\\nvoluptatem consequatur numquam aliquam sunt\\\\ntotam recusandae id dignissimos aut sed asperiores deserunt\\\"\\n  },\\n  {\\n    \\\"userId\\\": 7,\\n    \\\"id\\\": 62,\\n    \\\"title\\\": \\\"beatae enim quia vel\\\",\\n    \\\"body\\\": \\\"enim aspernatur illo distinctio quae praesentium\\\\nbeatae alias amet delectus qui voluptate distinctio\\\\nodit sint accusantium autem omnis\\\\nquo molestiae omnis ea eveniet optio\\\"\\n  }\\n]\"\n          },\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Sun, 16 Sep 2018 23:53:12 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"x-total-count\",\n              \"value\": \"100\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"a22-FI+zdCzw2iL/TSmHe3WZs7jlNFI\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"access-control-expose-headers\",\n              \"value\": \"X-Total-Count\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"45b7404dfd0e6be6-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Mon, 17 Sep 2018 03:53:12 GMT\"\n            }\n          ],\n          \"headersSize\": 693,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-09-16T23:53:12.472Z\",\n        \"time\": 191,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 191\n        }\n      },\n      {\n        \"_id\": \"74a9cff42a4c74f8db5d8ad814e9e9a1\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"accept\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"name\": \"referer\",\n              \"value\": \"http://localhost:3000/\"\n            },\n            {\n              \"name\": \"origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"user-agent\",\n              \"value\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3542.0 Safari/537.36\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json\"\n            }\n          ],\n          \"headersSize\": 345,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"postData\": {\n            \"mimeType\": \"application/json\"\n          },\n          \"queryString\": [\n            {\n              \"name\": \"id_like\",\n              \"value\": \"3|9|2|7|10|5\"\n            }\n          ],\n          \"url\": \"https://jsonplaceholder.typicode.com/users?id_like=3%7C9%7C2%7C7%7C10%7C5\"\n        },\n        \"response\": {\n          \"bodySize\": 3360,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 3360,\n            \"text\": \"[\\n  {\\n    \\\"id\\\": 2,\\n    \\\"name\\\": \\\"Ervin Howell\\\",\\n    \\\"username\\\": \\\"Antonette\\\",\\n    \\\"email\\\": \\\"Shanna@melissa.tv\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Victor Plains\\\",\\n      \\\"suite\\\": \\\"Suite 879\\\",\\n      \\\"city\\\": \\\"Wisokyburgh\\\",\\n      \\\"zipcode\\\": \\\"90566-7771\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-43.9509\\\",\\n        \\\"lng\\\": \\\"-34.4618\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"010-692-6593 x09125\\\",\\n    \\\"website\\\": \\\"anastasia.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Deckow-Crist\\\",\\n      \\\"catchPhrase\\\": \\\"Proactive didactic contingency\\\",\\n      \\\"bs\\\": \\\"synergize scalable supply-chains\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 3,\\n    \\\"name\\\": \\\"Clementine Bauch\\\",\\n    \\\"username\\\": \\\"Samantha\\\",\\n    \\\"email\\\": \\\"Nathan@yesenia.net\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Douglas Extension\\\",\\n      \\\"suite\\\": \\\"Suite 847\\\",\\n      \\\"city\\\": \\\"McKenziehaven\\\",\\n      \\\"zipcode\\\": \\\"59590-4157\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-68.6102\\\",\\n        \\\"lng\\\": \\\"-47.0653\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"1-463-123-4447\\\",\\n    \\\"website\\\": \\\"ramiro.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Romaguera-Jacobson\\\",\\n      \\\"catchPhrase\\\": \\\"Face to face bifurcated interface\\\",\\n      \\\"bs\\\": \\\"e-enable strategic applications\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 5,\\n    \\\"name\\\": \\\"Chelsey Dietrich\\\",\\n    \\\"username\\\": \\\"Kamren\\\",\\n    \\\"email\\\": \\\"Lucio_Hettinger@annie.ca\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Skiles Walks\\\",\\n      \\\"suite\\\": \\\"Suite 351\\\",\\n      \\\"city\\\": \\\"Roscoeview\\\",\\n      \\\"zipcode\\\": \\\"33263\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-31.8129\\\",\\n        \\\"lng\\\": \\\"62.5342\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(254)954-1289\\\",\\n    \\\"website\\\": \\\"demarco.info\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Keebler LLC\\\",\\n      \\\"catchPhrase\\\": \\\"User-centric fault-tolerant solution\\\",\\n      \\\"bs\\\": \\\"revolutionize end-to-end systems\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 7,\\n    \\\"name\\\": \\\"Kurtis Weissnat\\\",\\n    \\\"username\\\": \\\"Elwyn.Skiles\\\",\\n    \\\"email\\\": \\\"Telly.Hoeger@billy.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Rex Trail\\\",\\n      \\\"suite\\\": \\\"Suite 280\\\",\\n      \\\"city\\\": \\\"Howemouth\\\",\\n      \\\"zipcode\\\": \\\"58804-1099\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.8918\\\",\\n        \\\"lng\\\": \\\"21.8984\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"210.067.6132\\\",\\n    \\\"website\\\": \\\"elvis.io\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Johns Group\\\",\\n      \\\"catchPhrase\\\": \\\"Configurable multimedia task-force\\\",\\n      \\\"bs\\\": \\\"generate enterprise e-tailers\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 9,\\n    \\\"name\\\": \\\"Glenna Reichert\\\",\\n    \\\"username\\\": \\\"Delphine\\\",\\n    \\\"email\\\": \\\"Chaim_McDermott@dana.io\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Dayna Park\\\",\\n      \\\"suite\\\": \\\"Suite 449\\\",\\n      \\\"city\\\": \\\"Bartholomebury\\\",\\n      \\\"zipcode\\\": \\\"76495-3109\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"24.6463\\\",\\n        \\\"lng\\\": \\\"-168.8889\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"(775)976-6794 x41206\\\",\\n    \\\"website\\\": \\\"conrad.com\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Yost and Sons\\\",\\n      \\\"catchPhrase\\\": \\\"Switchable contextually-based project\\\",\\n      \\\"bs\\\": \\\"aggregate real-time technologies\\\"\\n    }\\n  },\\n  {\\n    \\\"id\\\": 10,\\n    \\\"name\\\": \\\"Clementina DuBuque\\\",\\n    \\\"username\\\": \\\"Moriah.Stanton\\\",\\n    \\\"email\\\": \\\"Rey.Padberg@karina.biz\\\",\\n    \\\"address\\\": {\\n      \\\"street\\\": \\\"Kattie Turnpike\\\",\\n      \\\"suite\\\": \\\"Suite 198\\\",\\n      \\\"city\\\": \\\"Lebsackbury\\\",\\n      \\\"zipcode\\\": \\\"31428-2261\\\",\\n      \\\"geo\\\": {\\n        \\\"lat\\\": \\\"-38.2386\\\",\\n        \\\"lng\\\": \\\"57.2232\\\"\\n      }\\n    },\\n    \\\"phone\\\": \\\"024-648-3804\\\",\\n    \\\"website\\\": \\\"ambrose.net\\\",\\n    \\\"company\\\": {\\n      \\\"name\\\": \\\"Hoeger LLC\\\",\\n      \\\"catchPhrase\\\": \\\"Centralized empowering task-force\\\",\\n      \\\"bs\\\": \\\"target end-to-end models\\\"\\n    }\\n  }\\n]\"\n          },\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"date\",\n              \"value\": \"Sun, 16 Sep 2018 23:53:13 GMT\"\n            },\n            {\n              \"name\": \"via\",\n              \"value\": \"1.1 vegur\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"cf-cache-status\",\n              \"value\": \"HIT\"\n            },\n            {\n              \"name\": \"x-powered-by\",\n              \"value\": \"Express\"\n            },\n            {\n              \"name\": \"status\",\n              \"value\": \"200\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"br\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            },\n            {\n              \"name\": \"server\",\n              \"value\": \"cloudflare\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"d20-ZHlyCzvRVweI5qleuamBhoeSO1g\\\"\"\n            },\n            {\n              \"name\": \"expect-ct\",\n              \"value\": \"max-age=604800, report-uri=\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\"\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Origin, Accept-Encoding\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"http://localhost:3000\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"access-control-allow-credentials\",\n              \"value\": \"true\"\n            },\n            {\n              \"name\": \"cf-ray\",\n              \"value\": \"45b74050bd976be6-SJC\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Mon, 17 Sep 2018 03:53:13 GMT\"\n            }\n          ],\n          \"headersSize\": 627,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-09-16T23:53:12.979Z\",\n        \"time\": 123,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 123\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/rest-persister/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <title>REST Persister Tests</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <link\n      rel=\"stylesheet\"\n      type=\"text/css\"\n      href=\"./node_modules/mocha/mocha.css\"\n    />\n  </head>\n  <body>\n    <div id=\"mocha\"></div>\n\n    <script src=\"./node_modules/mocha/mocha.js\"></script>\n    <script src=\"./node_modules/chai/chai.js\"></script>\n    <script src=\"./node_modules/@pollyjs/core/dist/umd/pollyjs-core.js\"></script>\n    <script src=\"./node_modules/@pollyjs/adapter-fetch/dist/umd/pollyjs-adapter-fetch.js\"></script>\n    <script src=\"./node_modules/@pollyjs/persister-rest/dist/umd/pollyjs-persister-rest.js\"></script>\n\n    <script src=\"./tests/setup.js\"></script>\n    <script src=\"./tests/rest-persister.test.js\"></script>\n\n    <script>\n      mocha.checkLeaks();\n      mocha.run();\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/rest-persister/package.json",
    "content": "{\n  \"name\": \"@pollyjs/rest-persister-example\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"scripts\": {\n    \"test\": \"start-server-and-test test:polly-server http://localhost:3000 test:server\",\n    \"test:server\": \"http-server -p 4000 -o -c-1 -s\",\n    \"test:polly-server\": \"polly listen\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-fetch\": \"*\",\n    \"@pollyjs/cli\": \"*\",\n    \"@pollyjs/core\": \"*\",\n    \"@pollyjs/persister-rest\": \"*\",\n    \"chai\": \"*\",\n    \"http-server\": \"*\",\n    \"mocha\": \"*\",\n    \"start-server-and-test\": \"*\"\n  }\n}\n"
  },
  {
    "path": "examples/rest-persister/recordings/REST-Persister_2289553200/should-work_3457346403/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"REST Persister/should work\",\n    \"browser\": {\n      \"name\": \"Chrome\",\n      \"version\": \"69.0\"\n    },\n    \"creator\": {\n      \"comment\": \"persister:rest\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"1.2.0\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"ffbc4836d419fc265c3b85cbe1b7f22e\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [],\n          \"headersSize\": 63,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [],\n          \"url\": \"https://jsonplaceholder.typicode.com/posts/1\"\n        },\n        \"response\": {\n          \"bodySize\": 292,\n          \"content\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 292,\n            \"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}\"\n          },\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=14400\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"expires\",\n              \"value\": \"Wed, 19 Sep 2018 04:14:08 GMT\"\n            },\n            {\n              \"name\": \"pragma\",\n              \"value\": \"no-cache\"\n            }\n          ],\n          \"headersSize\": 145,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-09-19T00:14:08.769Z\",\n        \"time\": 34,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 34\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/rest-persister/tests/rest-persister.test.js",
    "content": "/* global setupPolly */\n\ndescribe('REST Persister', function () {\n  setupPolly({\n    adapters: ['fetch'],\n    persister: 'rest'\n  });\n\n  it('should work', async function () {\n    const res = await fetch('https://jsonplaceholder.typicode.com/posts/1');\n    const post = await res.json();\n\n    expect(res.status).to.equal(200);\n    expect(post.id).to.equal(1);\n  });\n});\n"
  },
  {
    "path": "examples/rest-persister/tests/setup.js",
    "content": "// Expose common globals\nwindow.PollyJS = window['@pollyjs/core'];\nwindow.setupPolly = window.PollyJS.setupMocha;\nwindow.expect = window.chai.expect;\n\n// Register the fetch adapter and REST persister\nwindow.PollyJS.Polly.register(window['@pollyjs/adapter-fetch']);\nwindow.PollyJS.Polly.register(window['@pollyjs/persister-rest']);\n\n// Setup Mocha\nmocha.setup({ ui: 'bdd', noHighlighting: true });\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/__recordings__/github-api-client_2139812550/getUser_1648904580/recording.har",
    "content": "{\n  \"log\": {\n    \"_recordingName\": \"github-api client/getUser\",\n    \"creator\": {\n      \"comment\": \"persister:fs\",\n      \"name\": \"Polly.JS\",\n      \"version\": \"5.1.1\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"daab17694c1a59a0f3781977d2bf32d7\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 0,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"accept\",\n              \"value\": \"application/json+vnd.github.v3.raw\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"content-type\",\n              \"value\": \"application/json\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"user-agent\",\n              \"value\": \"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"accept-encoding\",\n              \"value\": \"gzip,deflate\"\n            },\n            {\n              \"_fromType\": \"array\",\n              \"name\": \"connection\",\n              \"value\": \"close\"\n            },\n            {\n              \"name\": \"host\",\n              \"value\": \"api.github.com\"\n            }\n          ],\n          \"headersSize\": 269,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"GET\",\n          \"queryString\": [],\n          \"url\": \"https://api.github.com/users/netflix\"\n        },\n        \"response\": {\n          \"bodySize\": 525,\n          \"content\": {\n            \"_isBinary\": true,\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"size\": 525,\n            \"text\": \"[\\\"1f8b080000000000000395935f6f9b3014c5bf0af2338981aceb8a146dd2fe5493d666d25aa9ca4b64c081bb1adbb20d2945fdeebb06b2647998c41360dddfb987eb7b7a2254\\\",\\\"0992a4e49ebbbd8017121228487a13afaede5f8744aa82effc01b9fbf2b5db3cdf74dbe45bc39e7455dc8a36fbfdfc72f7fa98dc1fd66b0459cb1c33bbc608acaf9cd336a5743cb4cb125cd5648de52657d271e996b9aa6943c74e1fdbf53b5428cda431b4c4830b2d0d93ce08a398a527e395abc545f7b1eb507daadb2b21d401d94babff91a77f217435be832ce70b20d453e52a8e7342fb6ffea7c1ba595606a0a7fe8177e3252cceddf0628e9d09413307893e7a6ab856835693d9dc8076a0e42c5bff8028a44cc924bcb2d942085ae4bda15906060041dee27acd2247a2a7da40cbf2ce8fc1f09c438b339daf7681a298eb34c785de9c4dc44f1a1cdfb1a2f6f9db336139e68dd5be70dad530f82ef32556e2fe6a263b92ca4688906418da296298303926f7980c501409a1f261f058f643d9e0963965c3e03313b0574602f363aa19f8a44ebcb2f6d3510afb61410586b34ca0a1a92da893b760a3b90c7ea9c6e43cf82998435d0fb90338376df7f83723ac9b4c40be1bef284da20f21998e8675266974cc1506f3ec0b03337ce5e8c5e17530871e92288e17d1f5225e3d24118aa551bcc5de8d2ece6b926811278b287948927415a7abab2d79fb03b458ebc7f1040000\\\"]\"\n          },\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"server\",\n              \"value\": \"GitHub.com\"\n            },\n            {\n              \"name\": \"date\",\n              \"value\": \"Sat, 19 Feb 2022 05:56:54 GMT\"\n            },\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            },\n            {\n              \"name\": \"cache-control\",\n              \"value\": \"public, max-age=60, s-maxage=60\"\n            },\n            {\n              \"name\": \"vary\",\n              \"value\": \"Accept, Accept-Encoding, Accept, X-Requested-With\"\n            },\n            {\n              \"name\": \"etag\",\n              \"value\": \"W/\\\"e7c5ada389fe724c41d8b2248ede8e368c0fdd159f907ca79d9c0a78fa3344cb\\\"\"\n            },\n            {\n              \"name\": \"last-modified\",\n              \"value\": \"Wed, 02 Dec 2020 22:31:35 GMT\"\n            },\n            {\n              \"name\": \"x-github-media-type\",\n              \"value\": \"github.v3; format=vnd.github.v3.raw\"\n            },\n            {\n              \"name\": \"access-control-expose-headers\",\n              \"value\": \"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset\"\n            },\n            {\n              \"name\": \"access-control-allow-origin\",\n              \"value\": \"*\"\n            },\n            {\n              \"name\": \"strict-transport-security\",\n              \"value\": \"max-age=31536000; includeSubdomains; preload\"\n            },\n            {\n              \"name\": \"x-frame-options\",\n              \"value\": \"deny\"\n            },\n            {\n              \"name\": \"x-content-type-options\",\n              \"value\": \"nosniff\"\n            },\n            {\n              \"name\": \"x-xss-protection\",\n              \"value\": \"0\"\n            },\n            {\n              \"name\": \"referrer-policy\",\n              \"value\": \"origin-when-cross-origin, strict-origin-when-cross-origin\"\n            },\n            {\n              \"name\": \"content-security-policy\",\n              \"value\": \"default-src 'none'\"\n            },\n            {\n              \"name\": \"content-encoding\",\n              \"value\": \"gzip\"\n            },\n            {\n              \"name\": \"x-ratelimit-limit\",\n              \"value\": \"60\"\n            },\n            {\n              \"name\": \"x-ratelimit-remaining\",\n              \"value\": \"59\"\n            },\n            {\n              \"name\": \"x-ratelimit-reset\",\n              \"value\": \"1645253814\"\n            },\n            {\n              \"name\": \"x-ratelimit-resource\",\n              \"value\": \"core\"\n            },\n            {\n              \"name\": \"x-ratelimit-used\",\n              \"value\": \"1\"\n            },\n            {\n              \"name\": \"accept-ranges\",\n              \"value\": \"bytes\"\n            },\n            {\n              \"name\": \"content-length\",\n              \"value\": \"525\"\n            },\n            {\n              \"name\": \"x-github-request-id\",\n              \"value\": \"F38D:0289:2486BB0:45D7297:621086A6\"\n            },\n            {\n              \"name\": \"connection\",\n              \"value\": \"close\"\n            }\n          ],\n          \"headersSize\": 1283,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2022-02-19T05:56:54.149Z\",\n        \"time\": 454,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 454\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/jest.config.ts",
    "content": "import type { Config } from \"@jest/types\";\n\nconst config: Config.InitialOptions = {\n  rootDir: \".\",\n  preset: \"ts-jest\",\n  testEnvironment: \"setup-polly-jest/jest-environment-jsdom\",\n  verbose: true,\n  testPathIgnorePatterns: [\"node_modules\", \"dist\"],\n  resetModules: true,\n  globals: {\n    \"ts-jest\": {\n      useESM: true,\n    },\n  },\n  transform: { },\n};\n\nexport default config;\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/package.json",
    "content": "{\n  \"name\": \"@pollyjs/typescript-jest-node-fetch-example\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"main\": \"./dist/index.js\",\n  \"type\": \"commonjs\",\n  \"exports\": \"./dist/index.js\",\n  \"scripts\": {\n    \"test\": \"jest --runInBand\",\n    \"test:record\": \"POLLY_MODE=record jest --runInBand --verbose\"\n  },\n  \"keywords\": [\n    \"pollyjs\",\n    \"test-mocking\",\n    \"jest\",\n    \"node\",\n    \"typescript\",\n    \"fetch\"\n  ],\n  \"author\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"node-fetch\": \"^2.6.6\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter-fetch\": \"^5.1.1\",\n    \"@pollyjs/adapter-node-http\": \"^5.1.1\",\n    \"@pollyjs/core\": \"^5.1.1\",\n    \"@pollyjs/node-server\": \"^5.1.1\",\n    \"@pollyjs/persister-fs\": \"^5.1.1\",\n    \"@types/jest\": \"^26.0.0\",\n    \"@types/node\": \"^16.11.11\",\n    \"@types/node-fetch\": \"^2.5.12\",\n    \"@types/pollyjs__adapter\": \"^4.3.1\",\n    \"@types/pollyjs__adapter-fetch\": \"^2.0.1\",\n    \"@types/pollyjs__adapter-node-http\": \"^2.0.1\",\n    \"@types/pollyjs__core\": \"^4.3.3\",\n    \"@types/pollyjs__persister\": \"^4.3.1\",\n    \"@types/pollyjs__persister-fs\": \"^2.0.1\",\n    \"@types/pollyjs__utils\": \"^2.6.1\",\n    \"@types/setup-polly-jest\": \"^0.5.1\",\n    \"jest\": \"^26.6.0\",\n    \"nodemon\": \"^2.0.15\",\n    \"setup-polly-jest\": \"^0.10.0\",\n    \"ts-jest\": \"^26.5.6\",\n    \"ts-node\": \"^10.4.0\",\n    \"typescript\": \"^4.5.2\"\n  }\n}\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/github-api.test.ts",
    "content": "/** @jest-environment setup-polly-jest/jest-environment-node */\nimport autoSetupPolly from './utils/auto-setup-polly';\nimport { getUser } from './github-api';\n\ndescribe('github-api client', () => {\n  let pollyContext = autoSetupPolly();\n\n  beforeEach(() => {\n    // Intercept /ping healthcheck requests (example)\n    pollyContext.polly.server\n      .any(\"/ping\")\n      .intercept((req, res) => void res.sendStatus(200));\n  });\n\n  it('getUser', async () => {\n    const user: any = await getUser('netflix');\n    expect(typeof user).toBe('object');\n    expect(user?.login).toBe('Netflix');\n  });\n\n  it('getUser: custom interceptor', async () => {\n    expect.assertions(1);\n    pollyContext.polly.server\n      .get('https://api.github.com/users/failing_request_trigger')\n      .intercept((req, res) => void res.sendStatus(500));\n\n    await expect(getUser('failing_request_trigger')).rejects.toThrow(\n      'Http Error: 500'\n    );\n  });\n});\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/github-api.ts",
    "content": "import fetch from \"node-fetch\";\nimport type { Response } from \"node-fetch\";\n\nexport const getUser = async (username: string): Promise<unknown> => {\n  return fetch(`https://api.github.com/users/${username}`, {\n    headers: {\n      \"Accept\": \"application/json+vnd.github.v3.raw\",\n      \"Content-type\": \"application/json\",\n    },\n  })\n  .then(checkErrorAndReturnJson);\n};\n\nfunction checkErrorAndReturnJson(response: Response) {\n  return response.ok\n    ? response.json()\n    : Promise.reject(new Error(`Http Error: ${response.status}`));  \n}\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/src/utils/auto-setup-polly.ts",
    "content": "import path from \"path\";\nimport { setupPolly } from \"setup-polly-jest\";\nimport { Polly, PollyConfig } from \"@pollyjs/core\";\nimport NodeHttpAdapter from \"@pollyjs/adapter-node-http\";\nimport FSPersister from \"@pollyjs/persister-fs\";\n\nPolly.register(NodeHttpAdapter);\nPolly.register(FSPersister);\n\nlet recordIfMissing = true;\nlet mode: PollyConfig['mode'] = 'replay';\n\nswitch (process.env.POLLY_MODE) {\n  case 'record':\n    mode = 'record';\n    break;\n  case 'replay':\n    mode = 'replay';\n    break;\n  case 'offline':\n    mode = 'replay';\n    recordIfMissing = false;\n    break;\n}\n\nexport default function autoSetupPolly() {\n  /**\n   * This persister can be adapted for both Node.js and Browser environments.\n   * \n   * TODO: Customize your config.\n   */\n  return setupPolly({\n    // 🟡 Note: In node, most `fetch` like libraries use the http/https modules.\n    // `node-fetch` is handled by `NodeHttpAdapter`, NOT the `FetchAdapter`.\n    adapters: [\"node-http\"],\n    mode,\n    recordIfMissing,\n    flushRequestsOnStop: true,\n    logging: false,\n    recordFailedRequests: true,\n    persister: \"fs\",\n    persisterOptions: {\n      fs: {\n        recordingsDir: path.resolve(__dirname, \"../../__recordings__\"),\n      },\n    },\n  });\n}\n"
  },
  {
    "path": "examples/typescript-jest-node-fetch/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES5\",\n    \"lib\": [\"esnext\"],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"esModuleInterop\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"strict\": true,\n    \"alwaysStrict\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"node\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"sourceMap\": true,\n    \"baseUrl\": \".\",\n    \"rootDir\": \".\",\n    \"outDir\": \"dist\",\n    \"useUnknownInCatchVariables\": false\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "jest.config.js",
    "content": "/* eslint-env node */\n\nmodule.exports = {\n  testURL: 'http://localhost:4000/api',\n  testMatch: ['**/@pollyjs/*/build/jest/*.js'],\n  roots: ['<rootDir>/packages/@pollyjs'],\n  reporters: ['jest-tap-reporter'],\n  testEnvironment: 'jsdom'\n};\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n  \"version\": \"6.0.7\",\n  \"npmClient\": \"yarn\",\n  \"useWorkspaces\": true,\n  \"packages\": [\"packages/@pollyjs/*\"],\n  \"command\": {\n    \"publish\": {\n      \"allowBranch\": \"master\",\n      \"conventionalCommits\": true,\n      \"message\": \"chore: Publish %s\",\n      \"ignoreChanges\": [\"docs/**\", \"examples/**\", \"**/tests/**\", \"**/*.md\"]\n    }\n  },\n  \"changelog\": {\n    \"repo\": \"Netflix/pollyjs\",\n    \"labels\": {\n      \"Tag: Breaking Change\": \":boom: Breaking Change\",\n      \"Tag: Enhancement\": \":rocket: Enhancement\",\n      \"Tag: Bug Fix\": \":bug: Bug Fix\",\n      \"Tag: Documentation\": \":memo: Documentation\"\n    }\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"private\": true,\n  \"license\": \"Apache-2.0\",\n  \"repository\": \"https://github.com/netflix/pollyjs\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"workspaces\": [\n    \"packages/@pollyjs/*\"\n  ],\n  \"lint-staged\": {\n    \"*.js\": [\n      \"eslint --fix\",\n      \"git add\"\n    ],\n    \"*.{json,md,html,yml,css}\": [\n      \"prettier --ignore-path .eslintignore --write\",\n      \"git add\"\n    ]\n  },\n  \"scripts\": {\n    \"build:prod\": \"NODE_ENV=production yarn build && NODE_ENV=production MINIFY=true yarn build\",\n    \"build:server\": \"lerna run build --scope=@pollyjs/node-server --scope=@pollyjs/utils\",\n    \"build\": \"lerna run build --ignore=@pollyjs/ember --parallel\",\n    \"clean\": \"rimraf packages/@pollyjs/*/dist && rimraf packages/@pollyjs/*/build\",\n    \"contributors\": \"npx contributor-faces -e '*\\\\[bot\\\\]'\",\n    \"docs:publish\": \"gh-pages --dist docs --dotfiles --message 'chore: Publish docs'\",\n    \"docs:serve\": \"docsify serve ./docs\",\n    \"lint:fix\": \"yarn run lint --fix\",\n    \"lint\": \"eslint .\",\n    \"postlint:fix\": \"prettier --ignore-path .eslintignore --write \\\"**/*.{json,md,html,yml,css}\\\"\",\n    \"postrelease:publish\": \"yarn docs:publish\",\n    \"prepare\": \"husky install\",\n    \"prerelease:publish\": \"npm-run-all clean build:prod\",\n    \"pretest:ci\": \"yarn clean && yarn build && yarn test:build\",\n    \"pretest\": \"./scripts/require-test-build.sh\",\n    \"release:publish\": \"lerna publish from-git\",\n    \"release:version\": \"lerna version\",\n    \"release\": \"npm-run-all \\\"release:version {@}\\\" release:publish --\",\n    \"test:build\": \"lerna run test:build --parallel\",\n    \"test:ci\": \"testem ci\",\n    \"test\": \"testem\",\n    \"watch\": \"lerna run watch-all --parallel\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.16.0\",\n    \"@babel/plugin-external-helpers\": \"^7.16.0\",\n    \"@babel/plugin-proposal-object-rest-spread\": \"^7.16.0\",\n    \"@babel/plugin-transform-runtime\": \"^7.16.4\",\n    \"@babel/preset-env\": \"^7.16.4\",\n    \"@babel/runtime\": \"^7.16.3\",\n    \"@babel/runtime-corejs2\": \"^7.16.3\",\n    \"@commitlint/cli\": \"^15.0.0\",\n    \"@commitlint/config-conventional\": \"^15.0.0\",\n    \"@commitlint/config-lerna-scopes\": \"^15.0.0\",\n    \"@commitlint/travis-cli\": \"^15.0.0\",\n    \"chai\": \"^4.3.4\",\n    \"compression\": \"^1.7.4\",\n    \"contributor-faces\": \"^1.1.0\",\n    \"deepmerge\": \"^4.2.0\",\n    \"docsify-cli\": \"^4.4.3\",\n    \"eslint\": \"^8.3.0\",\n    \"eslint-config-prettier\": \"^8.3.0\",\n    \"eslint-plugin-import\": \"^2.25.3\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.0.0\",\n    \"eslint-plugin-react\": \"^7.27.1\",\n    \"formdata-polyfill\": \"^4.0.10\",\n    \"gh-pages\": \"^3.2.3\",\n    \"har-validator\": \"^5.1.3\",\n    \"husky\": \"^7.0.4\",\n    \"jest\": \"^27.3.1\",\n    \"jest-tap-reporter\": \"^1.9.0\",\n    \"lerna\": \"^4.0.0\",\n    \"lerna-alias\": \"^3.0.2\",\n    \"lint-staged\": \"^12.1.2\",\n    \"mocha\": \"^9.1.3\",\n    \"npm-run-all\": \"^4.1.5\",\n    \"prettier\": \"^2.5.0\",\n    \"rimraf\": \"^3.0.2\",\n    \"rollup\": \"^1.14.6\",\n    \"rollup-plugin-alias\": \"^1.5.2\",\n    \"rollup-plugin-babel\": \"^4.4.0\",\n    \"rollup-plugin-commonjs\": \"^10.1.0\",\n    \"rollup-plugin-json\": \"^4.0.0\",\n    \"rollup-plugin-multi-entry\": \"^2.1.0\",\n    \"rollup-plugin-node-builtins\": \"^2.1.2\",\n    \"rollup-plugin-node-globals\": \"^1.4.0\",\n    \"rollup-plugin-node-resolve\": \"^5.2.0\",\n    \"rollup-plugin-terser\": \"5.0.0\",\n    \"testem\": \"^3.6.0\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n\n### Bug Fixes\n\n* Update types for class methods ([#438](https://github.com/netflix/pollyjs/issues/438)) ([b88655a](https://github.com/netflix/pollyjs/commit/b88655ac1b4ca7348afd45e9aeaa50e998ea68d7))\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n\n### Bug Fixes\n\n* **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ([cc2fa19](https://github.com/netflix/pollyjs/commit/cc2fa197a5c0a5fdef4602c4a207d31f3e677897))\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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. \n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Features\n\n* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/1223ba0))\n\n\n### BREAKING CHANGES\n\n* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/329)) ([9466989](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/9466989))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/cc46bb4))\n* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/8fd4d19))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### Bug Fixes\n\n* **adapter:** Clone the recording entry before mutating it ([#294](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/294)) ([d7e1303](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/d7e1303))\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/5b4edf3))\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Features\n\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/23a2127))\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n\n### Features\n\n* **core:** Improved control flow with `times` and `stopPropagation` ([#202](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/202)) ([2c8231e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/2c8231e))\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n\n### Bug Fixes\n\n* **adapter:** Log information if request couldn't be found in recording ([#172](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/172)) ([8dcdf7b](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/8dcdf7b))\n* Correctly handle array header values ([#179](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/179)) ([fb7dbb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/fb7dbb4))\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Bug Fixes\n\n* **adapter:** Test for navigator before accessing ([#165](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/165)) ([7200255](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/7200255))\n\n\n### Features\n\n* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/5b07b26))\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/12c8601))\n\n\n### BREAKING CHANGES\n\n* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Features\n\n* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/140)) ([548002c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/548002c))\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Config expiresIn can contain periods. i.e, 1.5 weeks ([e9c7aaa](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/e9c7aaa))\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/19fee5a))\n\n\n### Features\n\n* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/4ebacb8))\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/0a3d591))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/e622640))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/8bb313c))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/f902c6d))\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/a3113b7))\n* **core:** Server level configuration ([#80](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/80)) ([0f32d9b](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/0f32d9b))\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/a04d7a7))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"1.1.3\"></a>\n## [1.1.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@1.1.2...@pollyjs/adapter@1.1.3) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n<a name=\"1.1.2\"></a>\n## [1.1.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@1.1.1...@pollyjs/adapter@1.1.2) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n<a name=\"1.1.1\"></a>\n## [1.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@1.1.0...@pollyjs/adapter@1.1.1) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n<a name=\"1.1.0\"></a>\n# [1.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@1.0.0...@pollyjs/adapter@1.1.0) (2018-07-26)\n\n\n### Features\n\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/a3113b7))\n\n\n\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@0.3.1...@pollyjs/adapter@1.0.0) (2018-07-20)\n\n\n### Bug Fixes\n\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/19fee5a))\n\n\n### Features\n\n* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/4ebacb8))\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/0a3d591))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/e622640))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/f902c6d))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"0.3.1\"></a>\n## [0.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@0.3.0...@pollyjs/adapter@0.3.1) (2018-06-27)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter\n\n<a name=\"0.3.0\"></a>\n# [0.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@0.2.0...@pollyjs/adapter@0.3.0) (2018-06-21)\n\n\n### Features\n\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/a04d7a7))\n\n\n\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/compare/@pollyjs/adapter@0.1.0...@pollyjs/adapter@0.2.0) (2018-06-16)\n\n\n### Features\n\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter/commit/8bb313c))\n"
  },
  {
    "path": "packages/@pollyjs/adapter/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/adapter/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fadapter.svg)](https://badge.fury.io/js/%40pollyjs%2Fadapter)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/adapter` package provides an extendable base adapter class that\ncontains core logic dependent on by the [Fetch](https://netflix.github.io/pollyjs/#/adapters/fetch)\n& [XHR](https://netflix.github.io/pollyjs/#/adapters/xhr) adapters.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter -D\n```\n\n## Documentation\n\nCheck out the [Custom Adapter](https://netflix.github.io/pollyjs/#/adapters/custom)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport Adapter from '@pollyjs/adapter';\n\nclass CustomAdapter extends Adapter {\n  static get id() {\n    return 'custom';\n  }\n\n  onConnect() {\n    /* Do something when the adapter is connect to */\n  }\n\n  onDisconnect() {\n    /* Do something when the adapter is disconnected from */\n  }\n}\n```\n\nFor better usage examples, please refer to the source code for\nthe [Fetch](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/core/src/adapters/fetch/index.js) & [XHR](https://github.com/Netflix/pollyjs/blob/master/packages/%40pollyjs/core/src/adapters/xhr/index.js) adapters.\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/adapter/package.json",
    "content": "{\n  \"name\": \"@pollyjs/adapter\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Extendable base adapter class used by @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-adapter.js\",\n  \"module\": \"dist/es/pollyjs-adapter.js\",\n  \"browser\": \"dist/umd/pollyjs-adapter.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter\",\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"adapter\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"@pollyjs/utils\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createNodeTestConfig(), createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/adapter/src/index.js",
    "content": "import {\n  ACTIONS,\n  MODES,\n  EXPIRY_STRATEGIES,\n  PollyError,\n  Serializers,\n  assert\n} from '@pollyjs/utils';\n\nimport isExpired from './utils/is-expired';\nimport stringifyRequest from './utils/stringify-request';\nimport normalizeRecordedResponse from './utils/normalize-recorded-response';\n\nconst REQUEST_HANDLER = Symbol();\n\nexport default class Adapter {\n  constructor(polly) {\n    this.polly = polly;\n    this.isConnected = false;\n  }\n\n  static get type() {\n    return 'adapter';\n  }\n\n  /* eslint-disable-next-line getter-return */\n  static get id() {\n    assert('Must override the static `id` getter.');\n  }\n\n  get defaultOptions() {\n    return {};\n  }\n\n  get options() {\n    return {\n      ...(this.defaultOptions || {}),\n      ...((this.polly.config.adapterOptions || {})[this.constructor.id] || {})\n    };\n  }\n\n  get persister() {\n    return this.polly.persister;\n  }\n\n  connect() {\n    if (!this.isConnected) {\n      this.onConnect();\n      this.isConnected = true;\n\n      this.polly.logger.log.debug(\n        `Connected to ${this.constructor.id} adapter.`\n      );\n    }\n  }\n\n  onConnect() {\n    this.assert('Must implement the `onConnect` hook.');\n  }\n\n  disconnect() {\n    if (this.isConnected) {\n      this.onDisconnect();\n      this.isConnected = false;\n\n      this.polly.logger.log.debug(\n        `Disconnected from ${this.constructor.id} adapter.`\n      );\n    }\n  }\n\n  onDisconnect() {\n    this.assert('Must implement the `onDisconnect` hook.');\n  }\n\n  timeout(pollyRequest, { time }) {\n    const { timing } = pollyRequest.config;\n\n    if (typeof timing === 'function') {\n      return timing(time);\n    }\n  }\n\n  async handleRequest(request) {\n    const pollyRequest = this.polly.registerRequest(request);\n\n    try {\n      pollyRequest.on('identify', (...args) => this.onIdentifyRequest(...args));\n\n      await this.onRequest(pollyRequest);\n      await pollyRequest.init();\n      await this[REQUEST_HANDLER](pollyRequest);\n\n      if (pollyRequest.aborted) {\n        throw new PollyError('Request aborted.');\n      }\n\n      await this.onRequestFinished(pollyRequest);\n    } catch (error) {\n      await this.onRequestFailed(pollyRequest, error);\n    }\n\n    return pollyRequest;\n  }\n\n  async [REQUEST_HANDLER](pollyRequest) {\n    const { mode } = this.polly;\n    const { _interceptor: interceptor } = pollyRequest;\n\n    if (pollyRequest.aborted) {\n      return;\n    }\n\n    if (pollyRequest.shouldIntercept) {\n      await this.intercept(pollyRequest, interceptor);\n\n      if (interceptor.shouldIntercept) {\n        return;\n      }\n    }\n\n    if (\n      mode === MODES.PASSTHROUGH ||\n      pollyRequest.shouldPassthrough ||\n      interceptor.shouldPassthrough\n    ) {\n      return this.passthrough(pollyRequest);\n    }\n\n    this.assert(\n      'A persister must be configured in order to record and replay requests.',\n      !!this.persister\n    );\n\n    if (mode === MODES.RECORD) {\n      return this.record(pollyRequest);\n    }\n\n    if (mode === MODES.REPLAY) {\n      return this.replay(pollyRequest);\n    }\n\n    // This should never be reached. If it did, then something screwy happened.\n    this.assert(\n      'Unhandled request: \\n' + stringifyRequest(pollyRequest, null, 2)\n    );\n  }\n\n  async passthrough(pollyRequest) {\n    pollyRequest.action = ACTIONS.PASSTHROUGH;\n\n    return this.onPassthrough(pollyRequest);\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   */\n  async onPassthrough(pollyRequest) {\n    const response = await this.onFetchResponse(pollyRequest);\n\n    await pollyRequest.respond(response);\n  }\n\n  async intercept(pollyRequest, interceptor) {\n    pollyRequest.action = ACTIONS.INTERCEPT;\n    await pollyRequest._intercept(interceptor);\n\n    if (interceptor.shouldIntercept) {\n      return this.onIntercept(pollyRequest, pollyRequest.response);\n    }\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   * @param {PollyResponse} pollyResponse\n   */\n  async onIntercept(pollyRequest, pollyResponse) {\n    await pollyRequest.respond(pollyResponse);\n  }\n\n  async record(pollyRequest) {\n    pollyRequest.action = ACTIONS.RECORD;\n\n    if ('navigator' in global && !navigator.onLine) {\n      pollyRequest.log.warn(\n        '[Polly] Recording may fail because the browser is offline.\\n' +\n          `${stringifyRequest(pollyRequest)}`\n      );\n    }\n\n    return this.onRecord(pollyRequest);\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   */\n  async onRecord(pollyRequest) {\n    await this.onPassthrough(pollyRequest);\n\n    if (!pollyRequest.aborted) {\n      await this.persister.recordRequest(pollyRequest);\n    }\n  }\n\n  async replay(pollyRequest) {\n    const { config } = pollyRequest;\n    const recordingEntry = await this.persister.findEntry(pollyRequest);\n\n    if (recordingEntry) {\n      /*\n        Clone the recording entry so any changes will not actually persist to\n        the stored recording.\n\n        Note: Using JSON.parse/stringify instead of lodash/cloneDeep since\n              the recording entry is stored as json.\n      */\n      const clonedRecordingEntry = JSON.parse(JSON.stringify(recordingEntry));\n\n      await pollyRequest._emit('beforeReplay', clonedRecordingEntry);\n\n      if (isExpired(clonedRecordingEntry.startedDateTime, config.expiresIn)) {\n        const message =\n          'Recording for the following request has expired.\\n' +\n          `${stringifyRequest(pollyRequest, null, 2)}`;\n\n        switch (config.expiryStrategy) {\n          // exit into the record flow if expiryStrategy is \"record\".\n          case EXPIRY_STRATEGIES.RECORD:\n            return this.record(pollyRequest);\n          // throw an error and exit if expiryStrategy is \"error\".\n          case EXPIRY_STRATEGIES.ERROR:\n            this.assert(message);\n            break;\n          // log a warning and continue if expiryStrategy is \"warn\".\n          case EXPIRY_STRATEGIES.WARN:\n            pollyRequest.log.warn(`[Polly] ${message}`);\n            break;\n          // throw an error if we encounter an unsupported expiryStrategy.\n          default:\n            this.assert(\n              `Invalid config option passed for \"expiryStrategy\": \"${config.expiryStrategy}\"`\n            );\n            break;\n        }\n      }\n\n      await this.timeout(pollyRequest, clonedRecordingEntry);\n      pollyRequest.action = ACTIONS.REPLAY;\n\n      return this.onReplay(\n        pollyRequest,\n        normalizeRecordedResponse(clonedRecordingEntry.response),\n        clonedRecordingEntry\n      );\n    }\n\n    if (config.recordIfMissing) {\n      return this.record(pollyRequest);\n    }\n\n    this.assert(\n      'Recording for the following request is not found and `recordIfMissing` is `false`.\\n' +\n        stringifyRequest(pollyRequest, null, 2)\n    );\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   * @param {Object} normalizedResponse The normalized response generated from the recording entry\n   * @param {Object} recordingEntry The entire recording entry\n   */\n  async onReplay(pollyRequest, normalizedResponse) {\n    await pollyRequest.respond(normalizedResponse);\n  }\n\n  assert(message, ...args) {\n    assert(\n      `[${this.constructor.type}:${this.constructor.id}] ${message}`,\n      ...args\n    );\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   */\n  onRequest() {}\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   */\n  async onIdentifyRequest(pollyRequest) {\n    const { identifiers } = pollyRequest;\n\n    // Serialize the request body so it can be properly hashed\n    for (const type of ['blob', 'formData', 'buffer']) {\n      identifiers.body = await Serializers[type](identifiers.body);\n    }\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   */\n  async onRequestFinished(pollyRequest) {\n    await this.onRespond(pollyRequest);\n    pollyRequest.promise.resolve();\n  }\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   * @param {Error} [error]\n   */\n  async onRequestFailed(pollyRequest, error) {\n    const { aborted } = pollyRequest;\n\n    error = error || new PollyError('Request failed due to an unknown error.');\n\n    try {\n      if (aborted) {\n        await pollyRequest._emit('abort');\n      } else {\n        await pollyRequest._emit('error', error);\n      }\n\n      await this.onRespond(pollyRequest, error);\n    } finally {\n      pollyRequest.promise.reject(error);\n    }\n  }\n\n  /**\n   * Make sure the response from a Polly request is delivered to the\n   * user through the adapter interface.\n   *\n   * Calling `pollyjs.flush()` will await this method.\n   *\n   * @param {PollyRequest} pollyRequest\n   * @param {Error} [error]\n   */\n  async onRespond(/* pollyRequest, error */) {}\n\n  /**\n   * @param {PollyRequest} pollyRequest\n   * @returns {Object({ statusCode: number, headers: Object, body: string })}\n   */\n  async onFetchResponse(/* pollyRequest */) {\n    this.assert('Must implement the `onFetchResponse` hook.');\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/dehumanize-time.js",
    "content": "const ALPHA_NUMERIC_DOT = /([0-9.]+)([a-zA-Z]+)/g;\nconst TIMES = {\n  ms: 1,\n  millisecond: 1,\n  milliseconds: 1,\n  s: 1000,\n  sec: 1000,\n  secs: 1000,\n  second: 1000,\n  seconds: 1000,\n  m: 60000,\n  min: 60000,\n  mins: 60000,\n  minute: 60000,\n  minutes: 60000,\n  h: 3600000,\n  hr: 3600000,\n  hrs: 3600000,\n  hour: 3600000,\n  hours: 3600000,\n  d: 86400000,\n  day: 86400000,\n  days: 86400000,\n  w: 604800000,\n  wk: 604800000,\n  wks: 604800000,\n  week: 604800000,\n  weeks: 604800000,\n  y: 31536000000,\n  yr: 31536000000,\n  yrs: 31536000000,\n  year: 31536000000,\n  years: 31536000000\n};\n\nexport default function dehumanizeTime(input) {\n  if (typeof input !== 'string') {\n    return NaN;\n  }\n\n  const parts = input.replace(/ /g, '').match(ALPHA_NUMERIC_DOT);\n  const sets = parts.map((part) =>\n    part.split(ALPHA_NUMERIC_DOT).filter((o) => o)\n  );\n\n  return sets.reduce((accum, [number, unit]) => {\n    return accum + parseFloat(number) * TIMES[unit];\n  }, 0);\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/is-expired.js",
    "content": "import dehumanizeTime from './dehumanize-time';\n\nexport default function isExpired(recordedOn, expiresIn) {\n  if (recordedOn && expiresIn) {\n    return (\n      new Date() >\n      new Date(new Date(recordedOn).getTime() + dehumanizeTime(expiresIn))\n    );\n  }\n\n  return false;\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/normalize-recorded-response.js",
    "content": "const { isArray } = Array;\n\nexport default function normalizeRecordedResponse(response) {\n  const { status, statusText, headers, content } = response;\n\n  return {\n    statusText,\n    statusCode: status,\n    headers: normalizeHeaders(headers),\n    body: content && content.text,\n    encoding: content && content.encoding\n  };\n}\n\nfunction normalizeHeaders(headers) {\n  return (headers || []).reduce((accum, { name, value, _fromType }) => {\n    const existingValue = accum[name];\n\n    if (existingValue) {\n      if (!isArray(existingValue)) {\n        accum[name] = [existingValue];\n      }\n\n      accum[name].push(value);\n    } else {\n      accum[name] = _fromType === 'array' ? [value] : value;\n    }\n\n    return accum;\n  }, {});\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/src/utils/stringify-request.js",
    "content": "export default function stringifyRequest(req, ...args) {\n  const config = { ...req.config };\n\n  // Remove all adapter & persister config options as they can cause a circular\n  // structure to the final JSON\n  ['adapter', 'adapterOptions', 'persister', 'persisterOptions'].forEach(\n    (k) => delete config[k]\n  );\n\n  return JSON.stringify(\n    {\n      url: req.url,\n      method: req.method,\n      headers: req.headers,\n      body: req.body,\n      recordingName: req.recordingName,\n      id: req.id,\n      order: req.order,\n      identifiers: req.identifiers,\n      config\n    },\n    ...args\n  );\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/adapter-test.js",
    "content": "import Adapter from '../../src';\n\ndescribe('Unit | Adapter', function () {\n  it('should exist', function () {\n    expect(Adapter).to.be.a('function');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/utils/dehumanize-time-test.js",
    "content": "import dehumanizeTime from '../../../src/utils/dehumanize-time';\n\ndescribe('Unit | Utils | dehumanizeTime', function () {\n  it('should exist', function () {\n    expect(dehumanizeTime).to.be.a('function');\n  });\n\n  it('should work', function () {\n    expect(dehumanizeTime(null)).to.be.NaN;\n    expect(dehumanizeTime(undefined)).to.be.NaN;\n    expect(dehumanizeTime(true)).to.be.NaN;\n    expect(dehumanizeTime(false)).to.be.NaN;\n\n    [\n      [['1ms', '1millisecond', '1 milliseconds'], 1],\n      [['10ms', '10millisecond', '10 milliseconds'], 10],\n      [['100ms', '100millisecond', '100 milliseconds'], 100],\n      [['1s', '1sec', '1secs', '1 second', '1 seconds'], 1000],\n      [['1.5s', '1.5sec', '1.5secs', '1.5 second', '1.5 seconds'], 1500],\n      [['1m', '1min', '1mins', '1 minute', '1 minutes'], 1000 * 60],\n      [['1h', '1hr', '1hrs', '1 hour', '1 hours'], 1000 * 60 * 60],\n      [['1d', '1day', '1 days'], 1000 * 60 * 60 * 24],\n      [['1w', '1wk', '1wks', '1 week', '1 weeks'], 1000 * 60 * 60 * 24 * 7],\n      [['1y', '1yr', '1 yrs', '1 year', '1 years'], 1000 * 60 * 60 * 24 * 365],\n      [\n        [\n          '1y 2 wks 3day 4 minutes 5secs 6 ms',\n          '6 millisecond 5s 4 min 3d 2 weeks 1yrs'\n        ],\n        33005045006\n      ]\n    ].forEach(([inputs, value]) => {\n      inputs.forEach((str) => expect(dehumanizeTime(str)).to.equal(value));\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter/tests/unit/utils/is-expired-test.js",
    "content": "import isExpired from '../../../src/utils/is-expired';\n\ndescribe('Unit | Utils | isExpired', function () {\n  it('should exist', function () {\n    expect(isExpired).to.be.a('function');\n  });\n\n  it('should work', function () {\n    [\n      [undefined, undefined, false],\n      [null, null, false],\n      [new Date(), undefined, false],\n      [undefined, '1 day', false],\n      [new Date(), '1 day', false],\n      [new Date('1/1/2018'), '100 years', false],\n      [new Date('1/1/2017'), '1y', true],\n      [new Date('1/1/2018'), '1m5d10h', true]\n    ].forEach(([recordedOn, expiresIn, value]) => {\n      expect(isExpired(recordedOn, expiresIn)).to.equal(value);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter/types.d.ts",
    "content": "import { Polly, Request, Interceptor, Response } from '@pollyjs/core';\n\nexport default class Adapter<\n  TOptions extends {} = {},\n  TRequest extends Request = Request\n> {\n  static readonly id: string;\n  static readonly type: string;\n  constructor(polly: Polly);\n  polly: Polly;\n  isConnected: boolean;\n  readonly defaultOptions: TOptions;\n  readonly options: TOptions;\n  persister: Polly['persister'];\n  connect(): void;\n  onConnect(): void;\n  disconnect(): void;\n  onDisconnect(): void;\n  private timeout(request: TRequest, options: { time: number }): Promise<void>;\n  handleRequest(\n    request: Pick<\n      TRequest,\n      'url' | 'method' | 'headers' | 'body' | 'requestArguments'\n    >\n  ): Promise<TRequest>;\n  private passthrough(request: TRequest): Promise<void>;\n  onPassthrough(request: TRequest): Promise<void>;\n  private intercept(request: TRequest, interceptor: Interceptor): Promise<void>;\n  onIntercept(request: TRequest, interceptor: Interceptor): Promise<void>;\n  private record(request: TRequest): Promise<void>;\n  onRecord(request: TRequest): Promise<void>;\n  private replay(request: TRequest): Promise<void>;\n  onReplay(request: TRequest): Promise<void>;\n  assert(message: string, condition?: boolean): void;\n  onFetchResponse(\n    pollyRequest: TRequest\n  ): Promise<Pick<Response, 'statusCode' | 'headers' | 'body' | 'encoding'>>;\n  onRespond(request: TRequest, error?: Error): Promise<void>;\n  onIdentifyRequest(request: TRequest): Promise<void>;\n  onRequest(request: TRequest): Promise<void>;\n  onRequestFinished(request: TRequest): Promise<void>;\n  onRequestFailed(request: TRequest): Promise<void>;\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.7](https://github.com/netflix/pollyjs/compare/v6.0.6...v6.0.7) (2025-05-31)\n\n\n### Bug Fixes\n\n* 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))\n\n\n\n\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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. \n* Recording file name will no longer have trailing dashes\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n\n### Bug Fixes\n\n* Handle failed arraybuffer instanceof checks ([#393](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/393)) ([247be0a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/247be0a))\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Add statusText to the response ([#341](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/341)) ([0d45953](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/0d45953))\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **adapter-fetch:** Add support for handling binary data ([#332](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/332)) ([111bebf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/111bebf))\n* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/48ea1d7))\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/cc46bb4))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### Bug Fixes\n\n* **core:** Disconnect from all adapters when `pause` is called ([#291](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/291)) ([5c655bf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/5c655bf))\n\n\n### BREAKING CHANGES\n\n* **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.\n\n\n\n\n\n## [3.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v3.0.0...v3.0.1) (2019-12-25)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Fix \"failed to construct Request\" issue ([#287](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/287)) ([d17ab9b](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/d17ab9b)), closes [#286](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/286)\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/5b4edf3))\n* **adapter-fetch:** Correctly handle Request instance passed into fetch ([#259](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/259)) ([593ecb9](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/593ecb9))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Features\n\n* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/5a6fda6))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Handle `Request` objects as URLs ([#220](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/220)) ([bb28d54](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/bb28d54))\n\n\n### Features\n\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/23a2127))\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n\n### Features\n\n* **core:** Improved control flow with `times` and `stopPropagation` ([#202](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/202)) ([2c8231e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/2c8231e))\n\n\n\n\n\n## [2.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.3.0...v2.3.1) (2019-03-06)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Correctly handle key/value pairs headers ([dc0323d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/dc0323d))\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n\n### Features\n\n* **core:** Filter requests matched by a route handler ([#189](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/189)) ([5d57c32](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/5d57c32))\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/12c8601))\n\n\n### BREAKING CHANGES\n\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n# [1.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.3.2...v1.4.0) (2018-12-07)\n\n\n### Bug Fixes\n\n* **adapter-fetch:** Deprecate usage in Node in favor of node-http ([#146](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/146)) ([001ccdd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/001ccdd))\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Bug Fixes\n\n* Support URL objects ([#139](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/139)) ([cf0d755](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/cf0d755))\n* **core:** Ignore `context` options from being deep merged ([#144](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/144)) ([2123d83](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/2123d83))\n\n\n### Features\n\n* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/140)) ([548002c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/548002c))\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Allow 204 responses without a body ([#101](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/101)) ([20b4125](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/20b4125))\n* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/79cdd96))\n\n\n### Features\n\n* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/82ebd09))\n\n\n\n\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/@pollyjs/adapter-fetch@1.0.4...@pollyjs/adapter-fetch@1.0.5) (2018-08-22)\n\n\n### Bug Fixes\n\n* Allow 204 responses without a body ([#101](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/101)) ([20b4125](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/20b4125))\n\n\n\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/@pollyjs/adapter-fetch@1.0.3...@pollyjs/adapter-fetch@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/@pollyjs/adapter-fetch@1.0.2...@pollyjs/adapter-fetch@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/@pollyjs/adapter-fetch@1.0.1...@pollyjs/adapter-fetch@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/compare/@pollyjs/adapter-fetch@1.0.0...@pollyjs/adapter-fetch@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-fetch\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n### Bug Fixes\n\n* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/79cdd96))\n\n\n### Features\n\n* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-fetch/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch/commit/82ebd09))\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fadapter-fetch.svg)](https://badge.fury.io/js/%40pollyjs%2Fadapter-fetch)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/adapter-fetch` package provides a fetch adapter that wraps the\nglobal fetch method for seamless recording and replaying of requests.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-fetch -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-fetch -D\n```\n\n## Documentation\n\nCheck out the [Fetch Adapter](https://netflix.github.io/pollyjs/#/adapters/fetch)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\n\nPolly.register(FetchAdapter);\n\nnew Polly('<Recording Name>', {\n  adapters: ['fetch']\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/package.json",
    "content": "{\n  \"name\": \"@pollyjs/adapter-fetch\",\n  \"version\": \"6.0.7\",\n  \"description\": \"Fetch adapter for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-adapter-fetch.js\",\n  \"module\": \"dist/es/pollyjs-adapter-fetch.js\",\n  \"browser\": \"dist/umd/pollyjs-adapter-fetch.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"fetch\",\n    \"adapter\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/adapter\": \"^6.0.6\",\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"to-arraybuffer\": \"^1.0.1\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/core\": \"^6.0.6\",\n    \"@pollyjs/persister-local-storage\": \"^6.0.6\",\n    \"@pollyjs/persister-rest\": \"^6.0.6\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/rollup.config.test.js",
    "content": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/src/index.js",
    "content": "import Adapter from '@pollyjs/adapter';\nimport { cloneArrayBuffer, isBufferUtf8Representable } from '@pollyjs/utils';\nimport { Buffer } from 'buffer/';\nimport bufferToArrayBuffer from 'to-arraybuffer';\n\nimport serializeHeaders from './utils/serializer-headers';\n\nconst { defineProperty } = Object;\nconst IS_STUBBED = Symbol();\nconst ABORT_HANDLER = Symbol();\nconst REQUEST_ARGUMENTS = Symbol();\n\nexport default class FetchAdapter extends Adapter {\n  static get id() {\n    return 'fetch';\n  }\n\n  get defaultOptions() {\n    return {\n      context: global\n    };\n  }\n\n  onConnect() {\n    const { context } = this.options;\n\n    ['fetch', 'Request', 'Response', 'Headers'].forEach((key) =>\n      this.assert(`${key} global not found.`, !!(context && context[key]))\n    );\n    this.assert(\n      'Running concurrent fetch adapters is unsupported, stop any running Polly instances.',\n      !context.fetch[IS_STUBBED] && !context.Request[IS_STUBBED]\n    );\n\n    this.nativeFetch = context.fetch;\n    this.NativeRequest = context.Request;\n\n    const NativeRequest = this.NativeRequest;\n\n    /*\n      Patch the Request constructor so we can store all the passed in options.\n      This allows us to access the `body` directly instead of having to do\n      `await req.blob()` as well as not having to hard code each option we want\n      to extract from the Request instance.\n    */\n    context.Request = function Request(url, options) {\n      const request = new NativeRequest(url, options);\n      let args;\n\n      options = options || {};\n\n      /*\n        The Request constructor can receive another Request instance as\n        the first argument so we use its arguments and merge it with the\n        new options.\n     */\n      if (typeof url === 'object' && url[REQUEST_ARGUMENTS]) {\n        const reqArgs = url[REQUEST_ARGUMENTS];\n\n        args = { ...reqArgs, options: { ...reqArgs.options, ...options } };\n      } else {\n        args = { url, options };\n      }\n\n      defineProperty(request, REQUEST_ARGUMENTS, { value: args });\n\n      // Override the clone method to use our overridden constructor\n      request.clone = function clone() {\n        return new context.Request(request);\n      };\n\n      return request;\n    };\n\n    defineProperty(context.Request, IS_STUBBED, { value: true });\n\n    context.fetch = (url, options = {}) => {\n      let respond;\n\n      // Support Request object\n      if (typeof url === 'object' && url[REQUEST_ARGUMENTS]) {\n        const req = url;\n        const reqArgs = req[REQUEST_ARGUMENTS];\n\n        url = reqArgs.url;\n        options = { ...reqArgs.options, ...options };\n\n        // If a body exists in the Request instance, mimic reading the body\n        if ('body' in reqArgs.options) {\n          defineProperty(req, 'bodyUsed', { value: true });\n        }\n      }\n\n      const promise = new Promise((resolve, reject) => {\n        respond = ({ response, error }) => {\n          if (error) {\n            reject(error);\n          } else {\n            resolve(response);\n          }\n        };\n      });\n\n      this.handleRequest({\n        url,\n        method: options.method || 'GET',\n        headers: serializeHeaders(new context.Headers(options.headers)),\n        body: options.body,\n        requestArguments: { options, respond }\n      });\n\n      return promise;\n    };\n\n    defineProperty(context.fetch, IS_STUBBED, { value: true });\n  }\n\n  onDisconnect() {\n    const { context } = this.options;\n\n    context.fetch = this.nativeFetch;\n    context.Request = this.NativeRequest;\n\n    this.nativeFetch = null;\n    this.NativeRequest = null;\n  }\n\n  onRequest(pollyRequest) {\n    const {\n      options: { signal }\n    } = pollyRequest.requestArguments;\n\n    if (signal) {\n      if (signal.aborted) {\n        pollyRequest.abort();\n      } else {\n        pollyRequest[ABORT_HANDLER] = () => pollyRequest.abort();\n        signal.addEventListener('abort', pollyRequest[ABORT_HANDLER]);\n      }\n    }\n  }\n\n  async onFetchResponse(pollyRequest) {\n    const { context } = this.options;\n    const { options } = pollyRequest.requestArguments;\n\n    const response = await this.nativeFetch.apply(context, [\n      pollyRequest.url,\n      {\n        ...options,\n        method: pollyRequest.method,\n        headers: pollyRequest.headers,\n        body: pollyRequest.body\n      }\n    ]);\n\n    let arrayBuffer = await response.arrayBuffer();\n\n    /*\n      If the returned array buffer is not an instance of the global ArrayBuffer,\n      clone it in order to pass Buffer.from's instanceof check. This can happen\n      when using this adapter with a different context.\n\n      https://github.com/feross/buffer/issues/289\n    */\n    if (\n      arrayBuffer &&\n      !(arrayBuffer instanceof ArrayBuffer) &&\n      'byteLength' in arrayBuffer\n    ) {\n      arrayBuffer = cloneArrayBuffer(arrayBuffer);\n    }\n\n    const buffer = Buffer.from(arrayBuffer);\n    const isBinaryBuffer = !isBufferUtf8Representable(buffer);\n\n    return {\n      statusCode: response.status,\n      headers: serializeHeaders(response.headers),\n      body: buffer.toString(isBinaryBuffer ? 'base64' : 'utf8'),\n      encoding: isBinaryBuffer ? 'base64' : undefined\n    };\n  }\n\n  onRespond(pollyRequest, error) {\n    const {\n      context: { Response }\n    } = this.options;\n    const {\n      respond,\n      options: { signal }\n    } = pollyRequest.requestArguments;\n\n    if (signal && pollyRequest[ABORT_HANDLER]) {\n      signal.removeEventListener('abort', pollyRequest[ABORT_HANDLER]);\n    }\n\n    if (pollyRequest.aborted) {\n      respond({\n        error: new DOMException('The user aborted a request.', 'AbortError')\n      });\n\n      return;\n    }\n\n    if (error) {\n      respond({ error });\n\n      return;\n    }\n\n    const { absoluteUrl, response: pollyResponse } = pollyRequest;\n    const { statusCode, body, encoding } = pollyResponse;\n\n    let responseBody = body;\n\n    if (statusCode === 204 && responseBody === '') {\n      responseBody = null;\n    } else if (encoding) {\n      responseBody = bufferToArrayBuffer(Buffer.from(body, encoding));\n    }\n\n    const response = new Response(responseBody, {\n      status: statusCode,\n      statusText: pollyResponse.statusText,\n      headers: pollyResponse.headers\n    });\n\n    /*\n      Response does not allow `url` to be set manually (either via the\n      constructor or assignment) so force the url property via `defineProperty`.\n    */\n    defineProperty(response, 'url', { value: absoluteUrl });\n\n    respond({ response });\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/src/utils/serializer-headers.js",
    "content": "/**\n * Serialize a Headers instance into a pojo since it cannot be stringified.\n * @param {*} headers\n */\nexport default function serializeHeaders(headers) {\n  if (headers && typeof headers.forEach === 'function') {\n    const serializedHeaders = {};\n\n    headers.forEach((value, key) => (serializedHeaders[key] = value));\n\n    return serializedHeaders;\n  }\n\n  return headers || {};\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/adapter-test.js",
    "content": "import { Polly, setupMocha as setupPolly } from '@pollyjs/core';\nimport { URL } from '@pollyjs/utils';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport adapterTests from '@pollyjs-tests/integration/adapter-tests';\nimport adapterPollyTests from '@pollyjs-tests/integration/adapter-polly-tests';\nimport adapterBrowserTests from '@pollyjs-tests/integration/adapter-browser-tests';\nimport adapterIdentifierTests from '@pollyjs-tests/integration/adapter-identifier-tests';\nimport { Buffer } from 'buffer/';\n\nimport FetchAdapter from '../../src';\nimport pollyConfig from '../utils/polly-config';\n\nclass MockRequest {}\nclass MockResponse {}\nclass MockHeaders {}\n\ndescribe('Integration | Fetch Adapter', function () {\n  setupPolly.beforeEach(pollyConfig);\n\n  setupFetchRecord();\n  setupPolly.afterEach();\n\n  adapterTests();\n  adapterPollyTests();\n  adapterBrowserTests();\n  adapterIdentifierTests();\n\n  it('should support URL instances', async function () {\n    const { server } = this.polly;\n\n    server.any(this.recordUrl()).intercept((_, res) => res.sendStatus(200));\n\n    const res = await this.fetch(new URL(this.recordUrl()));\n\n    expect(res.status).to.equal(200);\n  });\n\n  it('should support array of key/value pair headers', async function () {\n    const { server } = this.polly;\n    let headers;\n\n    server\n      .any(this.recordUrl())\n      .on('request', (req) => {\n        headers = req.headers;\n      })\n      .intercept((_, res) => res.sendStatus(200));\n\n    const res = await this.fetchRecord({\n      headers: [['Content-Type', 'application/json']]\n    });\n\n    expect(res.status).to.equal(200);\n    expect(headers).to.deep.equal({ 'content-type': 'application/json' });\n  });\n\n  it('should handle aborting a request', async function () {\n    const { server } = this.polly;\n    const controller = new AbortController();\n    let abortEventCalled = false;\n    let error;\n\n    server\n      .any(this.recordUrl())\n      .on('request', () => controller.abort())\n      .on('abort', () => (abortEventCalled = true))\n      .intercept((_, res) => {\n        res.sendStatus(200);\n      });\n\n    try {\n      await this.fetchRecord({ signal: controller.signal });\n    } catch (e) {\n      error = e;\n    }\n\n    expect(abortEventCalled).to.equal(true);\n    expect(error.message).to.contain('The user aborted a request.');\n  });\n\n  it('should handle immediately aborting a request', async function () {\n    const { server } = this.polly;\n    const controller = new AbortController();\n    let abortEventCalled = false;\n    let error;\n\n    server\n      .any(this.recordUrl())\n      .on('abort', () => (abortEventCalled = true))\n      .intercept((_, res) => {\n        res.sendStatus(200);\n      });\n\n    try {\n      const promise = this.fetchRecord({ signal: controller.signal });\n\n      controller.abort();\n      await promise;\n    } catch (e) {\n      error = e;\n    }\n\n    expect(abortEventCalled).to.equal(true);\n    expect(error.message).to.contain('The user aborted a request.');\n  });\n\n  it('should be able to download binary content', async function () {\n    const fetch = async () =>\n      Buffer.from(\n        await this.fetch('/assets/32x32.png').then((res) => res.arrayBuffer())\n      );\n\n    this.polly.disconnectFrom(FetchAdapter);\n\n    const nativeResponseBuffer = await fetch();\n\n    this.polly.connectTo(FetchAdapter);\n\n    const recordedResponseBuffer = await fetch();\n\n    const { recordingName, config } = this.polly;\n\n    await this.polly.stop();\n    this.polly = new Polly(recordingName, config);\n    this.polly.replay();\n\n    const replayedResponseBuffer = await fetch();\n\n    expect(nativeResponseBuffer.equals(recordedResponseBuffer)).to.equal(true);\n    expect(recordedResponseBuffer.equals(replayedResponseBuffer)).to.equal(\n      true\n    );\n    expect(nativeResponseBuffer.equals(replayedResponseBuffer)).to.equal(true);\n  });\n\n  it('should return status text', async function () {\n    const { server } = this.polly;\n\n    server.any(this.recordUrl()).intercept((_, res) => res.sendStatus(200));\n\n    const res = await this.fetch(new Request(this.recordUrl()));\n\n    expect(res.statusText).to.equal('OK');\n  });\n\n  describe('Request', function () {\n    it('should support Request objects', async function () {\n      const { server } = this.polly;\n\n      server.any(this.recordUrl()).intercept((_, res) => res.sendStatus(200));\n\n      const res = await this.fetch(new Request(this.recordUrl()));\n\n      expect(res.status).to.equal(200);\n    });\n\n    it('should set bodyUsed to true if a body is present', async function () {\n      const { server } = this.polly;\n      const request = new Request('/', { method: 'POST', body: '{}' });\n\n      server.any().intercept((_, res) => res.sendStatus(200));\n\n      expect(request.bodyUsed).to.equal(false);\n      await this.fetch(request);\n      expect(request.bodyUsed).to.equal(true);\n    });\n\n    it('should not set bodyUsed to true if a body is not present', async function () {\n      const { server } = this.polly;\n      const request = new Request('/');\n\n      server.any().intercept((_, res) => res.sendStatus(200));\n\n      expect(request.bodyUsed).to.equal(false);\n      await this.fetch(request);\n      expect(request.bodyUsed).to.equal(false);\n    });\n\n    function testRequestOptions(createRequest, options) {\n      return async function () {\n        const { server } = this.polly;\n        let receivedOptions;\n\n        server.any().intercept((req, res) => {\n          receivedOptions = req.requestArguments.options;\n          res.sendStatus(200);\n        });\n\n        const res = await this.fetch(createRequest());\n\n        expect(res.status).to.equal(200);\n        expect(options).to.deep.equal(receivedOptions);\n      };\n    }\n\n    it(\n      'should handle no options',\n      testRequestOptions(() => new Request('/'), {})\n    );\n\n    it(\n      'should handle simple options',\n      testRequestOptions(\n        () =>\n          new Request('/', { method: 'POST', body: '{}', cache: 'no-cache' }),\n        { method: 'POST', body: '{}', cache: 'no-cache' }\n      )\n    );\n\n    it(\n      'should handle a cloned request',\n      testRequestOptions(\n        () => new Request('/', { method: 'POST', body: '{}' }).clone(),\n        { method: 'POST', body: '{}' }\n      )\n    );\n\n    it(\n      'should handle a request instance',\n      testRequestOptions(\n        () => new Request(new Request('/', { method: 'POST', body: '{}' })),\n        { method: 'POST', body: '{}' }\n      )\n    );\n\n    it(\n      'should handle a request instance with overrides',\n      testRequestOptions(\n        () =>\n          new Request(new Request('/', { method: 'POST', body: '{}' }), {\n            method: 'PATCH',\n            headers: { foo: 'bar' }\n          }),\n        { method: 'PATCH', headers: { foo: 'bar' }, body: '{}' }\n      )\n    );\n  });\n});\n\ndescribe('Integration | Fetch Adapter | Init', function () {\n  describe('Context', function () {\n    it(`should assign context's fetch as the native fetch and Request as the native Request`, async function () {\n      const polly = new Polly('context', { adapters: [] });\n      const fetch = () => {};\n      const adapterOptions = {\n        fetch: {\n          context: {\n            fetch,\n            Request: MockRequest,\n            Response: MockResponse,\n            Headers: MockHeaders\n          }\n        }\n      };\n\n      polly.configure({ adapters: [FetchAdapter], adapterOptions });\n\n      expect(polly.adapters.get('fetch').nativeFetch).to.equal(fetch);\n      expect(polly.adapters.get('fetch').nativeFetch).to.not.equal(\n        adapterOptions.fetch.context.fetch\n      );\n\n      expect(polly.adapters.get('fetch').NativeRequest).to.equal(MockRequest);\n      expect(polly.adapters.get('fetch').NativeRequest).to.not.equal(\n        adapterOptions.fetch.context.Request\n      );\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: { fetch: { context: {} } }\n        });\n      }).to.throw(/fetch global not found/);\n\n      await polly.stop();\n    });\n\n    it('should throw when context, fetch, Request, Response, and Headers are undefined', async function () {\n      const polly = new Polly('context', { adapters: [] });\n\n      polly.configure({\n        adapters: [FetchAdapter]\n      });\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: { fetch: { context: undefined } }\n        });\n      }).to.throw(/fetch global not found/);\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: {\n            fetch: {\n              context: {\n                fetch: undefined,\n                Request: MockRequest,\n                Response: MockResponse,\n                Headers: MockHeaders\n              }\n            }\n          }\n        });\n      }).to.throw(/fetch global not found/);\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: {\n            fetch: {\n              context: {\n                fetch() {},\n                Request: undefined,\n                Response: MockResponse,\n                Headers: MockHeaders\n              }\n            }\n          }\n        });\n      }).to.throw(/Request global not found/);\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: {\n            fetch: {\n              context: {\n                fetch() {},\n                Request: MockRequest,\n                Response: undefined,\n                Headers: MockHeaders\n              }\n            }\n          }\n        });\n      }).to.throw(/Response global not found/);\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: {\n            fetch: {\n              context: {\n                fetch() {},\n                Request: MockRequest,\n                Response: MockResponse,\n                Headers: undefined\n              }\n            }\n          }\n        });\n      }).to.throw(/Headers global not found/);\n\n      await polly.stop();\n    });\n  });\n\n  describe('Concurrency', function () {\n    it('should prevent concurrent fetch adapter instances', async function () {\n      const one = new Polly('one');\n      const two = new Polly('two');\n\n      one.connectTo(FetchAdapter);\n\n      expect(function () {\n        two.connectTo(FetchAdapter);\n      }).to.throw(/Running concurrent fetch adapters is unsupported/);\n\n      await one.stop();\n      await two.stop();\n    });\n\n    it('should allow you to register new instances once stopped', async function () {\n      const one = new Polly('one');\n      const two = new Polly('two');\n\n      one.connectTo(FetchAdapter);\n      await one.stop();\n\n      expect(function () {\n        two.connectTo(FetchAdapter);\n      }).to.not.throw();\n\n      await one.stop();\n      await two.stop();\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/persister-local-storage-test.js",
    "content": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport setupPersister from '@pollyjs-tests/helpers/setup-persister';\nimport persisterTests from '@pollyjs-tests/integration/persister-tests';\n\nimport pollyConfig from '../utils/polly-config';\n\ndescribe('Integration | Local Storage Persister', function () {\n  setupPolly.beforeEach({\n    ...pollyConfig,\n    persister: LocalStoragePersister\n  });\n\n  setupFetchRecord();\n  setupPersister();\n  setupPolly.afterEach();\n\n  persisterTests();\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/persister-rest-test.js",
    "content": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport RESTPersister from '@pollyjs/persister-rest';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport setupPersister from '@pollyjs-tests/helpers/setup-persister';\nimport persisterTests from '@pollyjs-tests/integration/persister-tests';\n\nimport pollyConfig from '../utils/polly-config';\n\ndescribe('Integration | REST Persister', function () {\n  setupPolly.beforeEach({\n    ...pollyConfig,\n    persister: RESTPersister,\n    persisterOptions: {\n      rest: { host: '' }\n    }\n  });\n\n  setupFetchRecord();\n  setupPersister();\n  setupPolly.afterEach();\n\n  persisterTests();\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/integration/server-test.js",
    "content": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport { PollyError } from '@pollyjs/utils';\n\nimport pollyConfig from '../utils/polly-config';\n\ndescribe('Integration | Server', function () {\n  setupPolly(pollyConfig);\n\n  it('calls all intercept handlers', async function () {\n    const { server } = this.polly;\n\n    server.any().intercept(async (_, res) => {\n      await server.timeout(5);\n      res.status(200);\n    });\n    server.any().intercept(async (_, res) => {\n      await server.timeout(5);\n      res.setHeader('x-foo', 'bar');\n    });\n    server.get('/ping').intercept((_, res) => res.json({ foo: 'bar' }));\n\n    const res = await fetch('/ping');\n    const json = await res.json();\n\n    expect(res.status).to.equal(200);\n    expect(res.headers.get('x-foo')).to.equal('bar');\n    expect(json).to.deep.equal({ foo: 'bar' });\n  });\n\n  it('breaks out of intercepts when using the interceptor API', async function () {\n    const { server } = this.polly;\n    let numIntercepts = 0;\n\n    server.namespace('/api/db/ping', () => {\n      server.any().intercept((_, res) => {\n        numIntercepts++;\n        res.status(200);\n      });\n      server.any().intercept((_, __, interceptor) => {\n        numIntercepts++;\n        interceptor.passthrough();\n      });\n      server.get().intercept((_, res) => {\n        numIntercepts++;\n        res.status(201);\n      });\n    });\n\n    expect((await fetch('/api/db/ping')).status).to.equal(404);\n    expect(numIntercepts).to.equal(2);\n  });\n\n  describe('API', function () {\n    it('.configure() - merges all configs', async function () {\n      const { server } = this.polly;\n      let config;\n\n      server.any().configure({ foo: 'foo' });\n      server.any().configure({ bar: 'bar' });\n      server\n        .get('/ping')\n        .configure({ foo: 'baz' })\n        .intercept((req, res) => {\n          config = req.config;\n          res.sendStatus(200);\n        });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(config).to.include({ foo: 'baz', bar: 'bar' });\n    });\n\n    it('.configure() - should throw when trying to override certain options', async function () {\n      const { server } = this.polly;\n\n      // The following options cannot be overridden on a per request basis\n      [\n        'mode',\n        'adapters',\n        'adapterOptions',\n        'persister',\n        'persisterOptions'\n      ].forEach((key) =>\n        expect(() => server.any().configure({ [key]: 'foo' })).to.throw(\n          PollyError,\n          /Invalid configuration option/\n        )\n      );\n    });\n\n    it('.recordingName()', async function () {\n      const { server } = this.polly;\n      let recordingName;\n\n      server\n        .get('/ping')\n        .recordingName('Override')\n        .intercept((req, res) => {\n          recordingName = req.recordingName;\n          res.sendStatus(200);\n        });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(recordingName).to.equal('Override');\n    });\n\n    it('.recordingName() - should reset when called with no arguments', async function () {\n      const { server } = this.polly;\n      let recordingName;\n\n      server.any().recordingName('Override');\n\n      server\n        .get('/ping')\n        .recordingName()\n        .intercept((req, res) => {\n          recordingName = req.recordingName;\n          res.sendStatus(200);\n        });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(recordingName).to.not.equal('Override');\n    });\n\n    it('.filter()', async function () {\n      const { server } = this.polly;\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.num === '1')\n        .intercept((req, res) => res.sendStatus(201));\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.num === '2')\n        .intercept((req, res) => res.sendStatus(202));\n\n      expect((await fetch('/ping?num=1')).status).to.equal(201);\n      expect((await fetch('/ping?num=2')).status).to.equal(202);\n    });\n\n    it('.filter() + events', async function () {\n      const { server } = this.polly;\n      let num;\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.num === '1')\n        .on('request', (req) => (num = req.query.num))\n        .intercept((req, res) => res.sendStatus(201));\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.num === '2')\n        .on('request', (req) => (num = req.query.num))\n        .intercept((req, res) => res.sendStatus(202));\n\n      expect((await fetch('/ping?num=1')).status).to.equal(201);\n      expect(num).to.equal('1');\n    });\n\n    it('.filter() - multiple', async function () {\n      const { server } = this.polly;\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.foo === 'foo')\n        .filter((req) => req.query.bar === 'bar')\n        .intercept((req, res) => res.sendStatus(201));\n\n      server\n        .get('/ping')\n        .filter((req) => req.query.foo === 'foo')\n        .filter((req) => req.query.baz === 'baz')\n        .intercept((req, res) => res.sendStatus(202));\n\n      expect((await fetch('/ping?foo=foo&bar=bar')).status).to.equal(201);\n      expect((await fetch('/ping?foo=foo&baz=baz')).status).to.equal(202);\n    });\n\n    it('.filter() - can access params', async function () {\n      const { server } = this.polly;\n      let id;\n\n      server\n        .get('/ping/:id')\n        .filter((req) => {\n          id = req.params.id;\n\n          return true;\n        })\n        .intercept((req, res) => res.sendStatus(201));\n\n      expect((await fetch('/ping/1')).status).to.equal(201);\n      expect(id).to.equal('1');\n    });\n\n    it('.filter() - should throw when not passed a function', async function () {\n      const { server } = this.polly;\n\n      expect(() => server.any().filter()).to.throw(\n        PollyError,\n        /Invalid filter callback provided/\n      );\n    });\n\n    it('.times()', async function () {\n      const { server } = this.polly;\n      let callCount = 0;\n\n      server\n        .get('/ping')\n        .times(1)\n        .on('request', () => callCount++)\n        .times()\n        .intercept((req, res) => res.sendStatus(200));\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(callCount).to.equal(1);\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(callCount).to.equal(1);\n    });\n\n    it('.intercept(_, { times }) & .on(_, { times })', async function () {\n      const { server } = this.polly;\n      let callCount = 0;\n\n      const handler = server\n        .get('/ping')\n        .on('request', () => callCount++, { times: 1 })\n        .intercept((req, res) => res.sendStatus(200), { times: 2 });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(callCount).to.equal(1);\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(callCount).to.equal(1);\n\n      expect(handler.has('intercept')).to.be.false;\n    });\n  });\n\n  describe('Events & Middleware', function () {\n    it('event: request', async function () {\n      const { server } = this.polly;\n      let requestCalled = false;\n\n      server\n        .get('/ping')\n        .intercept((req, res) => {\n          expect(requestCalled).to.be.true;\n          res.sendStatus(200);\n        })\n        .on('request', (req) => {\n          expect(requestCalled).to.be.false;\n\n          // Validate that we can modify the request\n          req.body = 'test';\n          expect(req.body).to.equal('test');\n\n          requestCalled = true;\n        });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(requestCalled).to.be.true;\n    });\n\n    it('event: beforeResponse', async function () {\n      const { server } = this.polly;\n      let beforeResponseCalled = false;\n\n      server\n        .get('/ping')\n        .intercept((req, res) => {\n          expect(beforeResponseCalled).to.be.false;\n          res.sendStatus(200);\n        })\n        .on('beforeResponse', (req, res) => {\n          expect(beforeResponseCalled).to.be.false;\n          expect(res.statusCode).to.equal(200);\n\n          res.sendStatus(201);\n          beforeResponseCalled = true;\n        });\n\n      expect((await fetch('/ping')).status).to.equal(201);\n      expect(beforeResponseCalled).to.be.true;\n    });\n\n    it('event: response', async function () {\n      const { server } = this.polly;\n      let responseCalled = false;\n\n      server\n        .get('/ping')\n        .intercept((req, res) => {\n          expect(responseCalled).to.be.false;\n          res.sendStatus(200);\n        })\n        .on('response', (req, res) => {\n          expect(responseCalled).to.be.false;\n          expect(req.didRespond).to.be.true;\n          expect(res.statusCode).to.equal(200);\n\n          // Validate that the req cant be modified\n          expect(() => (req.body = 'test')).to.throw(Error);\n\n          responseCalled = true;\n        });\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(responseCalled).to.be.true;\n    });\n\n    it('can register multiple event handlers', async function () {\n      const { server } = this.polly;\n      const stack = [];\n\n      server\n        .get('/ping')\n        .intercept((req, res) => res.sendStatus(200))\n        .on('request', () => stack.push(1))\n        .on('request', () => stack.push(2))\n        .on('beforeResponse', () => stack.push(3))\n        .on('beforeResponse', () => stack.push(4))\n        .on('response', () => stack.push(5))\n        .on('response', () => stack.push(6));\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(stack).to.deep.equal([1, 2, 3, 4, 5, 6]);\n    });\n\n    it('can turn off events', async function () {\n      const { server } = this.polly;\n      let requestCalled,\n        beforeResponseCalled = false;\n\n      const handler = server\n        .get('/ping')\n        .intercept((req, res) => res.sendStatus(200))\n        .on('request', () => (requestCalled = true))\n        .on('beforeResponse', () => (beforeResponseCalled = true));\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(requestCalled).to.be.true;\n      expect(beforeResponseCalled).to.be.true;\n\n      requestCalled = beforeResponseCalled = false;\n      handler.off('request').off('beforeResponse');\n\n      expect((await fetch('/ping')).status).to.equal(200);\n      expect(requestCalled).to.be.false;\n      expect(beforeResponseCalled).to.be.false;\n    });\n\n    it('events receive params', async function () {\n      const { server } = this.polly;\n\n      server\n        .any('/ping')\n        .on('request', (req) => {\n          expect(req.params).to.deep.equal({});\n        })\n        .on('beforeResponse', (req) => {\n          expect(req.params).to.deep.equal({});\n        });\n\n      server\n        .any('/ping/:id')\n        .on('request', (req) => {\n          expect(req.params).to.deep.equal({ id: '1' });\n        })\n        .on('beforeResponse', (req) => {\n          expect(req.params).to.deep.equal({ id: '1' });\n        });\n\n      server\n        .get('/ping/:id/:id2/*path')\n        .intercept((req, res) => res.sendStatus(200))\n        .on('request', (req) => {\n          expect(req.params).to.deep.equal({\n            id: '1',\n            id2: '2',\n            path: 'foo/bar'\n          });\n        })\n        .on('beforeResponse', (req) => {\n          expect(req.params).to.deep.equal({\n            id: '1',\n            id2: '2',\n            path: 'foo/bar'\n          });\n        });\n\n      expect((await fetch('/ping/1/2/foo/bar')).status).to.equal(200);\n    });\n\n    it('preserves middleware order', async function () {\n      const { server } = this.polly;\n      const requestOrder = [];\n      const beforeResponseOrder = [];\n\n      server\n        .any()\n        .on('request', () => {\n          requestOrder.push(1);\n        })\n        .on('beforeResponse', () => {\n          beforeResponseOrder.push(1);\n        });\n\n      server\n        .any()\n        .on('request', () => {\n          requestOrder.push(2);\n        })\n        .on('beforeResponse', () => {\n          beforeResponseOrder.push(2);\n        });\n\n      server\n        .any('/ping/:id')\n        .on('request', async () => {\n          await server.timeout(5);\n          requestOrder.push(3);\n        })\n        .on('beforeResponse', async () => {\n          await server.timeout(5);\n          beforeResponseOrder.push(3);\n        });\n\n      server\n        .any(['/ping', '/ping/*path'])\n        .on('request', () => {\n          requestOrder.push(4);\n        })\n        .on('beforeResponse', () => {\n          beforeResponseOrder.push(4);\n        });\n\n      server\n        .get('/ping/:id')\n        .intercept((req, res) => res.sendStatus(200))\n        .on('request', () => requestOrder.push(5))\n        .on('beforeResponse', () => beforeResponseOrder.push(5));\n\n      expect((await fetch('/ping/1')).status).to.equal(200);\n      expect(requestOrder).to.deep.equal([1, 2, 3, 4, 5]);\n      expect(beforeResponseOrder).to.deep.equal([1, 2, 3, 4, 5]);\n    });\n  });\n\n  describe('Control Flow', function () {\n    it('can control flow with .times() & .stopPropagation()', async function () {\n      const { server } = this.polly;\n      let calledBeforeDelete = false;\n      let calledAfterDelete = false;\n\n      // First call should return the user and not enter the 2nd handler\n      server\n        .get('/users/1')\n        .times(1)\n        .on('request', (req, e) => {\n          e.stopPropagation();\n          calledBeforeDelete = true;\n        })\n        .intercept((req, res, interceptor) => {\n          interceptor.stopPropagation();\n          res.sendStatus(200);\n        });\n\n      server.delete('/users/1').intercept((req, res) => res.status(204));\n\n      // Second call should 404 since the user no longer exists\n      server\n        .get('/users/1')\n        .times(1)\n        .on('request', () => (calledAfterDelete = true))\n        .intercept((req, res) => res.sendStatus(404));\n\n      expect((await fetch('/users/1')).status).to.equal(200);\n      expect(calledBeforeDelete).to.be.true;\n      expect(calledAfterDelete).to.be.false;\n\n      calledBeforeDelete = false;\n      expect((await fetch('/users/1', { method: 'DELETE' })).status).to.equal(\n        204\n      );\n\n      expect((await fetch('/users/1')).status).to.equal(404);\n      expect(calledBeforeDelete).to.be.false;\n      expect(calledAfterDelete).to.be.true;\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/tests/utils/polly-config.js",
    "content": "import InMemoryPersister from '@pollyjs/persister-in-memory';\n\nimport FetchAdapter from '../../src';\n\nexport default {\n  recordFailedRequests: true,\n  adapters: [FetchAdapter],\n  persister: InMemoryPersister\n};\n"
  },
  {
    "path": "packages/@pollyjs/adapter-fetch/types.d.ts",
    "content": "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",
    "content": "module.exports = {\n  env: {\n    browser: false,\n    node: true\n  },\n  overrides: [\n    {\n      files: ['tests/jest/**/*.js'],\n      env: {\n        browser: true\n      }\n    }\n  ]\n};\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### Features\n\n* **adapter-node-http:** Upgrade nock to v13 ([#424](https://github.com/netflix/pollyjs/issues/424)) ([2d5b59e](https://github.com/netflix/pollyjs/commit/2d5b59ee0c33ea53a64321249246fcae0a616a3f))\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* Recording file name will no longer have trailing dashes\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [5.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v5.0.1...v5.0.2) (2020-12-06)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Remove module monkey patching on disconnect ([#369](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/369)) ([0cec43a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/0cec43a))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/48ea1d7))\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/329)) ([9466989](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/9466989))\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/cc46bb4))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/41dd093))\n* **adapter-node-http:** Bump nock version ([#319](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/319)) ([7d361a6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/7d361a6))\n\n\n\n\n\n## [4.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.0.2...v4.0.3) (2020-01-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Use requestBodyBuffers to parse body ([#304](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/304)) ([113fec5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/113fec5))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n## [3.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v3.0.1...v3.0.2) (2020-01-08)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Bump nock version to correctly handle re… ([#289](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/289)) ([8d0ae97](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/8d0ae97)), closes [#278](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/278)\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.7.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.6.3...v2.7.0) (2019-11-21)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Correctly handle uploading binary data ([#257](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/257)) ([31f0e0a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/31f0e0a))\n\n\n### Features\n\n* **adapter-node-http:** Upgrade nock to v11.x ([#273](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/273)) ([5d42cbd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/5d42cbd))\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Features\n\n* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/5a6fda6))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Features\n\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/23a2127))\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-node-http/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-node-http/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/12c8601))\n\n\n*  feat(adapter-node-http): Use `nock` under the hood instead of custom implementation (#166) ([62374f4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/62374f4)), closes [#166](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/issues/166)\n\n\n### BREAKING CHANGES\n\n* The node-http adapter no longer accepts the `transports` option\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Fix unhandled rejection if connection fails ([#160](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-node-http/issues/160)) ([12fcfa7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/12fcfa7))\n* **adapter-node-http:** Pause socket on original request ([#162](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-node-http/issues/162)) ([8f0c56c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/8f0c56c))\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-node-http\n\n\n\n\n\n# [1.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/compare/v1.3.2...v1.4.0) (2018-12-07)\n\n\n### Features\n\n* Node HTTP Adapter ([#128](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-node-http/issues/128)) ([fa059a4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http/commit/fa059a4))\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fadapter-node-http.svg)](https://badge.fury.io/js/%40pollyjs%2Fadapter-node-http)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/adapter-node-http` package 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.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-node-http -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-node-http -D\n```\n\n## Documentation\n\nCheck out the [Node HTTP Adapter](https://netflix.github.io/pollyjs/#/adapters/node-http)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport NodeHTTPAdapter from '@pollyjs/adapter-node-http';\n\nPolly.register(NodeHTTPAdapter);\n\nnew Polly('<Recording Name>', {\n  adapters: ['node-http']\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/package.json",
    "content": "{\n  \"name\": \"@pollyjs/adapter-node-http\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Node HTTP adapter for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-adapter-node-http.js\",\n  \"module\": \"dist/es/pollyjs-adapter-node-http.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-node-http\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Yasin Uslu\",\n      \"email\": \"a.yasin.uslu@gmail.com\"\n    },\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"http\",\n    \"adapter\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/adapter\": \"^6.0.6\",\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"lodash-es\": \"^4.17.21\",\n    \"nock\": \"^13.2.1\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/core\": \"^6.0.6\",\n    \"@pollyjs/persister-fs\": \"^6.0.6\",\n    \"form-data\": \"^4.0.0\",\n    \"get-stream\": \"^6.0.1\",\n    \"node-fetch\": \"^2.6.6\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/rollup.config.js",
    "content": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nimport { external } from './rollup.config.shared';\n\nexport default createNodeConfig({ external });\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/rollup.config.shared.js",
    "content": "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",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createJestTestConfig from '../../../scripts/rollup/jest.test.config';\n\nimport { external } from './rollup.config.shared';\n\nconst testExternal = [...external, 'fs', 'path'];\n\nexport default [\n  createNodeTestConfig({ external: testExternal }),\n  createJestTestConfig({ external: testExternal })\n];\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/index.js",
    "content": "import http from 'http';\nimport https from 'https';\nimport { URL } from 'url';\nimport { Readable as ReadableStream } from 'stream';\n\nimport nock from 'nock';\nimport {\n  normalizeClientRequestArgs,\n  isUtf8Representable,\n  isContentEncoded\n} from 'nock/lib/common';\nimport Adapter from '@pollyjs/adapter';\nimport { HTTP_METHODS } from '@pollyjs/utils';\n\nimport getUrlFromOptions from './utils/get-url-from-options';\nimport mergeChunks from './utils/merge-chunks';\nimport urlToOptions from './utils/url-to-options';\n\nconst IS_STUBBED = Symbol();\nconst ABORT_HANDLER = Symbol();\nconst REQUEST_ARGUMENTS = new WeakMap();\n\n// nock begins to intercept network requests on import which is not the\n// behavior we want, so restore the original behavior right away.\nnock.restore();\n\nexport default class HttpAdapter extends Adapter {\n  static get id() {\n    return 'node-http';\n  }\n\n  onConnect() {\n    this.assert(\n      'Running concurrent node-http adapters is unsupported, stop any running Polly instances.',\n      !http.ClientRequest[IS_STUBBED]\n    );\n    this.assert(\n      'Running nock concurrently with the node-http adapter is unsupported. Run nock.restore() before connecting to this adapter.',\n      !nock.isActive()\n    );\n\n    this.NativeClientRequest = http.ClientRequest;\n    this.setupNock();\n\n    // Patch methods overridden by nock to add some missing functionality\n    this.patchOverriddenMethods();\n  }\n\n  onDisconnect() {\n    this.unpatchOverriddenMethods();\n    nock.cleanAll();\n    nock.restore();\n    this.NativeClientRequest = null;\n  }\n\n  setupNock() {\n    const adapter = this;\n\n    // Make sure there aren't any other interceptors defined\n    nock.cleanAll();\n\n    // Create our interceptor that will match all hosts\n    const interceptor = nock(/.*/).persist();\n\n    HTTP_METHODS.forEach((m) => {\n      // Add an intercept for each supported HTTP method that will match all paths\n      interceptor.intercept(/.*/, m).reply(function (_, _body, respond) {\n        const { req, method } = this;\n        const { headers } = req;\n        const parsedArguments = normalizeClientRequestArgs(\n          ...REQUEST_ARGUMENTS.get(req)\n        );\n        const url = getUrlFromOptions(parsedArguments.options);\n        const requestBodyBuffer = Buffer.concat(req.requestBodyBuffers);\n        const body = isUtf8Representable(requestBodyBuffer)\n          ? requestBodyBuffer.toString('utf8')\n          : requestBodyBuffer;\n\n        adapter.handleRequest({\n          url,\n          method,\n          headers,\n          body,\n          requestArguments: { req, body, respond, parsedArguments }\n        });\n      });\n    });\n\n    // Activate nock so it can start to intercept all outgoing requests\n    nock.activate();\n  }\n\n  patchOverriddenMethods() {\n    const modules = { http, https };\n    const { ClientRequest } = http;\n\n    // Patch the already overridden ClientRequest class so we can get\n    // access to the original arguments and use them when creating the\n    // passthrough request.\n    http.ClientRequest = function _ClientRequest() {\n      const req = new ClientRequest(...arguments);\n\n      REQUEST_ARGUMENTS.set(req, [...arguments]);\n\n      return req;\n    };\n\n    // Add an IS_STUBBED boolean so we can check on onConnect if we've already\n    // patched the necessary methods.\n    http.ClientRequest[IS_STUBBED] = true;\n\n    // Patch http.request, http.get, https.request, and https.get\n    // to set some default values which nock doesn't properly set.\n    Object.keys(modules).forEach((moduleName) => {\n      const module = modules[moduleName];\n      const { request, get, globalAgent } = module;\n\n      this[moduleName] = {\n        get,\n        request\n      };\n\n      function parseArgs() {\n        const args = normalizeClientRequestArgs(...arguments);\n\n        if (moduleName === 'https') {\n          args.options = {\n            ...{ port: 443, protocol: 'https:', _defaultAgent: globalAgent },\n            ...args.options\n          };\n        } else {\n          args.options = {\n            ...{ port: 80, protocol: 'http:' },\n            ...args.options\n          };\n        }\n\n        return args;\n      }\n\n      module.request = function _request() {\n        const { options, callback } = parseArgs(...arguments);\n\n        return request(options, callback);\n      };\n\n      module.get = function _get() {\n        const { options, callback } = parseArgs(...arguments);\n\n        return get(options, callback);\n      };\n    });\n  }\n\n  unpatchOverriddenMethods() {\n    const modules = { http, https };\n\n    Object.keys(modules).forEach((moduleName) => {\n      const module = modules[moduleName];\n\n      module.request = this[moduleName].request;\n      module.get = this[moduleName].get;\n      this[moduleName] = undefined;\n    });\n  }\n\n  onRequest(pollyRequest) {\n    const { req } = pollyRequest.requestArguments;\n\n    if (req.aborted) {\n      pollyRequest.abort();\n    } else {\n      pollyRequest[ABORT_HANDLER] = () => {\n        if (!pollyRequest.aborted && (req.aborted || req.destroyed)) {\n          pollyRequest.abort();\n        }\n      };\n\n      req.once('abort', pollyRequest[ABORT_HANDLER]);\n      req.once('close', pollyRequest[ABORT_HANDLER]);\n    }\n  }\n\n  async onFetchResponse(pollyRequest) {\n    const { parsedArguments } = pollyRequest.requestArguments;\n    const { method, headers, body } = pollyRequest;\n    const { options } = parsedArguments;\n\n    const request = new this.NativeClientRequest({\n      ...options,\n      method,\n      headers: { ...headers },\n      ...urlToOptions(new URL(pollyRequest.url))\n    });\n\n    const chunks = this.getChunksFromBody(body, headers);\n\n    const responsePromise = new Promise((resolve, reject) => {\n      request.once('response', resolve);\n      request.once('error', reject);\n      request.once('timeout', reject);\n    });\n\n    // Write the request body\n    chunks.forEach((chunk) => request.write(chunk));\n    request.end();\n\n    const response = await responsePromise;\n    const responseBody = await new Promise((resolve, reject) => {\n      const chunks = [];\n\n      response.on('data', (chunk) => chunks.push(chunk));\n      response.once('end', () =>\n        resolve(this.getBodyFromChunks(chunks, response.headers))\n      );\n      response.once('error', reject);\n    });\n\n    return {\n      headers: response.headers,\n      statusCode: response.statusCode,\n      body: responseBody.body,\n      encoding: responseBody.encoding\n    };\n  }\n\n  async onRespond(pollyRequest, error) {\n    const { req, respond } = pollyRequest.requestArguments;\n    const { statusCode, body, headers, encoding } = pollyRequest.response;\n\n    if (pollyRequest[ABORT_HANDLER]) {\n      req.off('abort', pollyRequest[ABORT_HANDLER]);\n      req.off('close', pollyRequest[ABORT_HANDLER]);\n    }\n\n    if (pollyRequest.aborted) {\n      // Even if the request has been aborted, we need to respond to the nock\n      // request in order to resolve its awaiting promise.\n      respond(null, [0, undefined, {}]);\n\n      return;\n    }\n\n    if (error) {\n      // If an error was received then forward it over to nock so it can\n      // correctly handle it.\n      respond(error);\n\n      return;\n    }\n\n    const chunks = this.getChunksFromBody(body, headers, encoding);\n    const stream = new ReadableStream();\n\n    // Expose the response data as a stream of chunks since\n    // it could contain encoded data which is needed\n    // to be pushed to the response chunk by chunk.\n    chunks.forEach((chunk) => stream.push(chunk));\n    stream.push(null);\n\n    // Create a promise that will resolve once the request\n    // has been completed (including errored or aborted). This is needed so\n    // that the deferred promise used by `polly.flush()` doesn't resolve before\n    // the response was actually received.\n    const requestFinishedPromise = new Promise((resolve) => {\n      if (req.aborted) {\n        resolve();\n      } else {\n        req.once('response', resolve);\n        req.once('abort', resolve);\n        req.once('error', resolve);\n      }\n    });\n\n    respond(null, [statusCode, stream, headers]);\n\n    await requestFinishedPromise;\n  }\n\n  getBodyFromChunks(chunks, headers) {\n    // If content-encoding is set in the header then the body/content\n    // should not be concatenated. Instead, the chunks should\n    // be preserved as-is so that each chunk can be mocked individually\n    if (isContentEncoded(headers)) {\n      const encodedChunks = chunks.map((chunk) => {\n        if (!Buffer.isBuffer(chunk)) {\n          this.assert(\n            'content-encoded responses must all be binary buffers',\n            typeof chunk === 'string'\n          );\n          chunk = Buffer.from(chunk);\n        }\n\n        return chunk.toString('base64');\n      });\n\n      return {\n        encoding: 'base64',\n        body: JSON.stringify(encodedChunks)\n      };\n    }\n\n    const buffer = mergeChunks(chunks);\n    const isBinaryBuffer = !isUtf8Representable(buffer);\n\n    // The merged buffer can be one of two things:\n    //  1. A binary buffer which then has to be recorded as a base64 string.\n    //  2. A string buffer.\n    return {\n      encoding: isBinaryBuffer ? 'base64' : undefined,\n      body: buffer.toString(isBinaryBuffer ? 'base64' : 'utf8')\n    };\n  }\n\n  getChunksFromBody(body, headers, encoding) {\n    if (!body) {\n      return [];\n    }\n\n    if (Buffer.isBuffer(body)) {\n      return [body];\n    }\n\n    // If content-encoding is set in the header then the body/content\n    // is as an array of base64 strings\n    if (isContentEncoded(headers)) {\n      const encodedChunks = JSON.parse(body);\n\n      return encodedChunks.map((chunk) => Buffer.from(chunk, encoding));\n    }\n\n    // The body can be one of two things:\n    //  1. A base64 string which then means its binary data.\n    //  2. A utf8 string which means a regular string.\n    return [Buffer.from(body, encoding ? encoding : 'utf8')];\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/get-url-from-options.js",
    "content": "import { URL } from '@pollyjs/utils';\n\n/**\n * Generate an absolute url from options passed into `new http.ClientRequest`.\n *\n * @export\n * @param {Object} [options]\n * @returns {string}\n */\nexport default function getUrlFromOptions(options = {}) {\n  if (options.href) {\n    return options.href;\n  }\n\n  const protocol = options.protocol || `${options.proto}:` || 'http:';\n  const host = options.hostname || options.host || 'localhost';\n  const { path, port } = options;\n  const url = new URL();\n\n  url.set('protocol', protocol);\n  url.set('host', host);\n  url.set('pathname', path);\n\n  if (\n    port &&\n    !host.includes(':') &&\n    (port !== 80 || protocol !== 'http:') &&\n    (port !== 443 || protocol !== 'https:')\n  ) {\n    url.set('port', port);\n  }\n\n  return url.href;\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/merge-chunks.js",
    "content": "/**\n * Merge an array of strings into a single string or concat an array\n * of buffers into a single buffer.\n *\n * @export\n * @param {string[] | Buffer[]} [chunks]\n * @returns {string | Buffer}\n */\nexport default function mergeChunks(chunks) {\n  if (!chunks || chunks.length === 0) {\n    return Buffer.alloc(0);\n  }\n\n  // We assume that all chunks are Buffer objects if the first is buffer object.\n  if (!Buffer.isBuffer(chunks[0])) {\n    // When the chunks are not buffers we assume that they are strings.\n    return chunks.join('');\n  }\n\n  // Merge all the buffers into a single Buffer object.\n  return Buffer.concat(chunks);\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/src/utils/url-to-options.js",
    "content": "/**\n * Utility function that converts a URL object into an ordinary\n * options object as expected by the http.request and https.request APIs.\n *\n * This was copied from Node's source\n * https://github.com/nodejs/node/blob/908292cf1f551c614a733d858528ffb13fb3a524/lib/internal/url.js#L1257\n */\nexport default function urlToOptions(url) {\n  const options = {\n    protocol: url.protocol,\n    hostname:\n      typeof url.hostname === 'string' && url.hostname.startsWith('[')\n        ? url.hostname.slice(1, -1)\n        : url.hostname,\n    hash: url.hash,\n    search: url.search,\n    pathname: url.pathname,\n    path: `${url.pathname}${url.search || ''}`,\n    href: url.href\n  };\n\n  if (url.port !== '') {\n    options.port = Number(url.port);\n  }\n\n  if (url.username || url.password) {\n    options.auth = `${url.username}:${url.password}`;\n  }\n\n  return options;\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/adapter-node-fetch-test.js",
    "content": "import '@pollyjs-tests/helpers/global-node-fetch';\n\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport adapterTests from '@pollyjs-tests/integration/adapter-tests';\nimport adapterNodeTests from '@pollyjs-tests/integration/adapter-node-tests';\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\nimport pollyConfig from '../utils/polly-config';\n\ndescribe('Integration | Node Http Adapter | node-fetch', function () {\n  setupPolly.beforeEach(pollyConfig);\n\n  setupFetchRecord({ host: 'http://localhost:4000' });\n  setupPolly.afterEach();\n\n  adapterTests();\n  adapterNodeTests();\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/adapter-test.js",
    "content": "import fs from 'fs';\nimport http from 'http';\nimport https from 'https';\nimport path from 'path';\n\nimport FormData from 'form-data';\nimport getStream from 'get-stream';\nimport adapterIdentifierTests from '@pollyjs-tests/integration/adapter-identifier-tests';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport adapterTests from '@pollyjs-tests/integration/adapter-tests';\nimport { Polly, setupMocha as setupPolly } from '@pollyjs/core';\n\nimport NodeHTTPAdapter from '../../src';\nimport nativeRequest from '../utils/native-request';\nimport pollyConfig from '../utils/polly-config';\nimport getResponseFromRequest from '../utils/get-response-from-request';\n\ndescribe('Integration | Node Http Adapter', function () {\n  describe('Concurrency', function () {\n    it('should prevent concurrent Node HTTP adapter instances', async function () {\n      const one = new Polly('one');\n      const two = new Polly('two');\n\n      one.connectTo(NodeHTTPAdapter);\n\n      expect(function () {\n        two.connectTo(NodeHTTPAdapter);\n      }).to.throw(/Running concurrent node-http adapters is unsupported/);\n\n      await one.stop();\n      await two.stop();\n    });\n\n    it('should prevent running nock concurrently with the node-http adapter', async function () {\n      const polly = new Polly('nock');\n      const nock = require('nock');\n\n      nock.activate();\n\n      expect(function () {\n        polly.connectTo(NodeHTTPAdapter);\n      }).to.throw(\n        /Running nock concurrently with the node-http adapter is unsupported/\n      );\n\n      nock.restore();\n      await polly.stop();\n    });\n  });\n\n  describe('http', function () {\n    setupPolly.beforeEach(pollyConfig);\n\n    setupFetchRecord({\n      host: 'http://localhost:4000',\n      fetch: nativeRequest.bind(undefined, http)\n    });\n\n    setupPolly.afterEach();\n\n    adapterTests();\n    adapterIdentifierTests();\n    commonTests(http);\n\n    it('should be able to download binary content', async function () {\n      const fetch = async () =>\n        Buffer.from(\n          await this.relativeFetch('/assets/32x32.png').then((res) =>\n            res.arrayBuffer()\n          )\n        );\n\n      this.polly.disconnectFrom(NodeHTTPAdapter);\n\n      const nativeResponseBuffer = await fetch();\n\n      this.polly.connectTo(NodeHTTPAdapter);\n\n      const recordedResponseBuffer = await fetch();\n\n      const { recordingName, config } = this.polly;\n\n      await this.polly.stop();\n      this.polly = new Polly(recordingName, config);\n      this.polly.replay();\n\n      const replayedResponseBuffer = await fetch();\n\n      expect(nativeResponseBuffer.equals(recordedResponseBuffer)).to.equal(\n        true\n      );\n      expect(recordedResponseBuffer.equals(replayedResponseBuffer)).to.equal(\n        true\n      );\n      expect(nativeResponseBuffer.equals(replayedResponseBuffer)).to.equal(\n        true\n      );\n    });\n  });\n\n  describe('https', function () {\n    setupPolly(pollyConfig);\n    commonTests(https);\n  });\n});\n\nfunction commonTests(transport) {\n  const { protocol } = transport.globalAgent;\n\n  it('should be able to upload a binary data', async function () {\n    const { server } = this.polly;\n    const url = `${protocol}//example.com`;\n    const body = Buffer.from('Node HTTP Adapter', 'base64');\n    const requests = [];\n\n    server.post(url).intercept((req, res) => {\n      requests.push(req);\n      res.sendStatus(204);\n    });\n\n    await nativeRequest(transport, url, { method: 'POST', body });\n    await nativeRequest(transport, url, { method: 'POST', body });\n\n    expect(requests).to.have.lengthOf(2);\n    expect(requests[0].id).to.equal(requests[1].id);\n    expect(requests[0].body.toString('base64')).to.equal(\n      body.toString('base64')\n    );\n    expect(requests[0].identifiers.body).to.equal(body.toString('base64'));\n  });\n\n  it('should be able to upload form data', async function () {\n    const url = `${protocol}//example.com/upload`;\n    const { server } = this.polly;\n    const formData = new FormData();\n    let request;\n\n    server.post(url).intercept((req, res) => {\n      request = req;\n      res.send(201);\n    });\n\n    formData.append(\n      'upload',\n      fs.createReadStream(path.resolve(__dirname, '../../package.json'))\n    );\n    const body = await getStream(formData);\n\n    await nativeRequest(transport, url, {\n      body,\n      headers: formData.getHeaders(),\n      method: 'POST'\n    });\n\n    expect(request).to.exist;\n    expect(typeof request.body).to.equal('string');\n    expect(request.body).to.include('@pollyjs/adapter-node-http');\n  });\n\n  it('should handle aborting a request', async function () {\n    const { server } = this.polly;\n    const url = `${protocol}//example.com`;\n    const req = transport.request(url);\n    let abortEventCalled = false;\n\n    server\n      .any(url)\n      .on('abort', () => (abortEventCalled = true))\n      .intercept(async (_, res) => {\n        await server.timeout(50);\n        res.sendStatus(200);\n      });\n\n    req.on('socket', () => {\n      setTimeout(() => {\n        req.abort();\n      }, 10);\n    });\n\n    try {\n      await getResponseFromRequest(req);\n    } catch (e) {\n      // no-op\n    }\n\n    await this.polly.flush();\n    expect(abortEventCalled).to.equal(true);\n  });\n\n  it('should handle immediately aborting a request', async function () {\n    const { server } = this.polly;\n    const url = `${protocol}//example.com`;\n    const req = transport.request(url);\n    let requestIntercepted = false;\n    let abortEventCalled = false;\n\n    server\n      .any(url)\n      .on('abort', () => (abortEventCalled = true))\n      .intercept(async (_, res) => {\n        requestIntercepted = true;\n        res.sendStatus(200);\n      });\n\n    const promise = getResponseFromRequest(req);\n\n    req.abort();\n\n    try {\n      await promise;\n    } catch (e) {\n      // no-op\n    }\n\n    await this.polly.flush();\n\n    // Nock will completely ignore requests that have been immediately aborted\n    expect(requestIntercepted).to.equal(false);\n    expect(abortEventCalled).to.equal(false);\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/integration/persister-fs-test.js",
    "content": "import http from 'http';\n\nimport setupPersister from '@pollyjs-tests/helpers/setup-persister';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport persisterTests from '@pollyjs-tests/integration/persister-tests';\nimport { setupMocha as setupPolly } from '@pollyjs/core';\nimport FSPersister from '@pollyjs/persister-fs';\n\nimport nativeRequest from '../utils/native-request';\nimport pollyConfig from '../utils/polly-config';\n\ndescribe('Integration | FS Persister', function () {\n  setupPolly.beforeEach({\n    ...pollyConfig,\n    persister: FSPersister,\n    persisterOptions: {\n      fs: { recordingsDir: 'tests/recordings' }\n    }\n  });\n\n  setupFetchRecord({\n    host: 'http://localhost:4000',\n    fetch: nativeRequest.bind(undefined, http)\n  });\n\n  setupPersister();\n  setupPolly.afterEach();\n\n  persisterTests();\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/jest/integration/fetch-test.js",
    "content": "import '@pollyjs-tests/helpers/global-node-fetch';\n\nimport { Polly } from '@pollyjs/core';\n\nimport pollyConfig from '../../utils/polly-config';\n\ndescribe('Integration | Jest | Fetch', function () {\n  let polly;\n\n  beforeEach(() => {\n    polly = new Polly('Integration | Jest | Fetch', pollyConfig);\n  });\n\n  afterEach(async () => await polly.stop());\n\n  test('it works', async () => {\n    polly.recordingName += '/it works';\n\n    const { persister, recordingId } = polly;\n\n    expect((await fetch('http://localhost:4000/api/db/foo')).status).toBe(404);\n    await persister.persist();\n\n    const har = await persister.findRecording(recordingId);\n\n    expect(har).toBeDefined();\n    expect(har.log.entries.length).toBe(1);\n    expect(har.log.entries[0].request.url.includes('/api/db/foo')).toBe(true);\n    expect(har.log.entries[0].response.status).toBe(404);\n\n    await persister.deleteRecording(recordingId);\n    expect(persister.findRecording(recordingId)).resolves.toBeNull();\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/jest/integration/xhr-test.js",
    "content": "import { Polly } from '@pollyjs/core';\n\nimport pollyConfig from '../../utils/polly-config';\n\nfunction request(url) {\n  return new Promise((resolve, reject) => {\n    const xhr = new XMLHttpRequest();\n\n    xhr.addEventListener('load', function () {\n      resolve(xhr);\n    });\n\n    xhr.addEventListener('error', reject);\n    xhr.open('GET', url, true);\n    xhr.send();\n  });\n}\n\ndescribe('Integration | Jest | XHR', function () {\n  let polly;\n\n  beforeEach(() => {\n    polly = new Polly('Integration | Jest | XHR', pollyConfig);\n  });\n\n  afterEach(async () => await polly.stop());\n\n  test('it works', async () => {\n    polly.recordingName += '/it works';\n\n    const { persister, recordingId } = polly;\n\n    expect((await request('/api/db/foo')).status).toBe(404);\n    await persister.persist();\n\n    const har = await persister.findRecording(recordingId);\n\n    expect(har).toBeDefined();\n    expect(har.log.entries.length).toBe(1);\n    expect(har.log.entries[0].request.url.includes('/api/db/foo')).toBe(true);\n    expect(har.log.entries[0].response.status).toBe(404);\n\n    await persister.deleteRecording(recordingId);\n    expect(persister.findRecording(recordingId)).resolves.toBeNull();\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/unit/utils/merge-chunks-test.js",
    "content": "import mergeChunks from '../../../src/utils/merge-chunks';\n\ndescribe('Unit | Utils | mergeChunks', function () {\n  it('should exist', function () {\n    expect(mergeChunks).to.be.a('function');\n  });\n\n  it('should work', function () {\n    [null, []].forEach((chunks) => {\n      const buffer = mergeChunks(chunks);\n\n      expect(Buffer.isBuffer(buffer)).to.be.true;\n      expect(buffer.toString()).to.have.lengthOf(0);\n    });\n\n    const str = mergeChunks(['T', 'e', 's', 't']);\n\n    expect(Buffer.isBuffer(str)).to.be.false;\n    expect(str).to.equal('Test');\n\n    const buffer = mergeChunks(['T', 'e', 's', 't'].map((c) => Buffer.from(c)));\n\n    expect(Buffer.isBuffer(buffer)).to.be.true;\n    expect(buffer.toString()).to.equal('Test');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/get-buffer-from-stream.js",
    "content": "export default function getBufferFromStream(stream) {\n  return new Promise((resolve) => {\n    const chunks = [];\n\n    stream.on('data', (chunk) => {\n      chunks.push(chunk);\n    });\n\n    stream.on('end', () => {\n      resolve(Buffer.concat(chunks));\n    });\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/get-response-from-request.js",
    "content": "export default function getResponseFromRequest(req, data) {\n  return new Promise((resolve, reject) => {\n    req.once('response', resolve);\n    req.once('error', reject);\n    req.once('abort', reject);\n\n    req.end(data);\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/native-request.js",
    "content": "import Url from 'url';\n\nimport { Response } from 'node-fetch';\n\nimport getResponseFromRequest from './get-response-from-request';\n\nexport default async function nativeRequest(transport, url, options) {\n  const opts = {\n    ...(options || {}),\n    ...Url.parse(url)\n  };\n  let reqBody;\n\n  if (opts.body) {\n    reqBody = opts.body;\n    delete opts.body;\n  }\n\n  const response = await getResponseFromRequest(\n    transport.request(opts),\n    reqBody\n  );\n\n  return new Response(response, {\n    status: response.statusCode,\n    headers: response.headers\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/tests/utils/polly-config.js",
    "content": "import InMemoryPersister from '@pollyjs/persister-in-memory';\n\nimport NodeHttpAdapter from '../../src';\n\nexport default {\n  recordFailedRequests: true,\n  adapters: [NodeHttpAdapter],\n  persister: InMemoryPersister,\n  persisterOptions: {}\n};\n"
  },
  {
    "path": "packages/@pollyjs/adapter-node-http/types.d.ts",
    "content": "import Adapter from '@pollyjs/adapter';\n\nexport default class NodeHttpAdapter extends Adapter {}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* Recording file name will no longer have trailing dashes\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Add prependListener puppeteer@4.0.0 removed ([#368](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/368)) ([6c35fd3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/6c35fd3))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### Bug Fixes\n\n* **core:** Disconnect from all adapters when `pause` is called ([#291](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/291)) ([5c655bf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/5c655bf))\n\n\n### BREAKING CHANGES\n\n* **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.\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Features\n\n* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/5a6fda6))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Features\n\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/23a2127))\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [2.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.3.1...v2.3.2) (2019-04-09)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Remove other resource type matching ([#197](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/197)) ([ea6bfcc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/ea6bfcc))\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/12c8601))\n\n\n### BREAKING CHANGES\n\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/53ad433))\n* Puppeteer 1.7.0 support ([#100](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/100)) ([e208b38](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/e208b38))\n* Puppeteer CORS request matching ([#110](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/110)) ([7831115](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/7831115))\n\n\n### Features\n\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/f902c6d))\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/a3113b7))\n\n\n\n\n<a name=\"1.1.4\"></a>\n## [1.1.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/@pollyjs/adapter-puppeteer@1.1.3...@pollyjs/adapter-puppeteer@1.1.4) (2018-08-22)\n\n\n### Bug Fixes\n\n* Puppeteer 1.7.0 support ([#100](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/100)) ([e208b38](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/e208b38))\n\n\n\n\n<a name=\"1.1.3\"></a>\n## [1.1.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/@pollyjs/adapter-puppeteer@1.1.2...@pollyjs/adapter-puppeteer@1.1.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n<a name=\"1.1.2\"></a>\n## [1.1.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/@pollyjs/adapter-puppeteer@1.1.1...@pollyjs/adapter-puppeteer@1.1.2) (2018-08-12)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/53ad433))\n\n\n\n\n<a name=\"1.1.1\"></a>\n## [1.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/@pollyjs/adapter-puppeteer@1.1.0...@pollyjs/adapter-puppeteer@1.1.1) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-puppeteer\n\n<a name=\"1.1.0\"></a>\n# [1.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/compare/@pollyjs/adapter-puppeteer@1.0.0...@pollyjs/adapter-puppeteer@1.1.0) (2018-07-26)\n\n\n### Features\n\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/a3113b7))\n\n\n\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n### Features\n\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-puppeteer/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer/commit/f902c6d))\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fadapter-puppeteer.svg)](https://badge.fury.io/js/%40pollyjs%2Fadapter-puppeteer)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/adapter-puppeteer` package provides a [Puppeteer](https://github.com/GoogleChrome/puppeteer) adapter\nto be used with `@pollyjs/core`.\n\n## Installation\n\n_If you're using puppeteer 1.7 or 1.8, you'll experience issues with passthrough requests. Please upgrade to the latest version of puppeteer or use a version prior to 1.7_\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-puppeteer -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-puppeteer -D\n```\n\n## Documentation\n\nCheck out the [Puppeteer Adapter](https://netflix.github.io/pollyjs/#/adapters/puppeteer)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport PuppeteerAdapter from '@pollyjs/adapter-puppeteer';\n\nPolly.register(PuppeteerAdapter);\n\nconst browser = await puppeteer.launch();\nconst page = await this.browser.newPage();\n\nawait page.setRequestInterception(true);\n\nnew Polly('<Recording Name>', {\n  adapters: ['puppeteer'],\n  adapterOptions: {\n    puppeteer: { page }\n  }\n});\n\nawait page.goto('https://netflix.com');\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/package.json",
    "content": "{\n  \"name\": \"@pollyjs/adapter-puppeteer\",\n  \"version\": \"6.0.6\",\n  \"description\": \"File system persister for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-adapter-puppeteer.js\",\n  \"module\": \"dist/es/pollyjs-adapter-puppeteer.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-puppeteer\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"fs\",\n    \"file\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"build:watch\": \"yarn build -w\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/adapter\": \"^6.0.6\",\n    \"@pollyjs/utils\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/core\": \"^6.0.6\",\n    \"@pollyjs/persister-fs\": \"^6.0.6\",\n    \"node-fetch\": \"^2.6.6\",\n    \"puppeteer\": \"1.10.0\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/rollup.config.js",
    "content": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nexport default createNodeConfig();\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\n\nexport default createNodeTestConfig({\n  external: ['puppeteer']\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/src/index.js",
    "content": "import Adapter from '@pollyjs/adapter';\nimport { URL } from '@pollyjs/utils';\n\nconst LISTENERS = Symbol();\nconst PASSTHROUGH_PROMISES = Symbol();\nconst PASSTHROUGH_REQ_ID_QP = 'pollyjs_passthrough_req_id';\n\nexport default class PuppeteerAdapter extends Adapter {\n  static get id() {\n    return 'puppeteer';\n  }\n\n  get defaultOptions() {\n    return {\n      page: null,\n      requestResourceTypes: ['xhr', 'fetch']\n    };\n  }\n\n  constructor() {\n    super(...arguments);\n\n    this._requestsMapping = {\n      passthroughs: new WeakMap(),\n      pollyRequests: new WeakMap()\n    };\n  }\n\n  onConnect() {\n    const { page } = this.options;\n\n    this[LISTENERS] = new Map();\n    this[PASSTHROUGH_PROMISES] = new Map();\n    this.assert(\n      'A puppeteer page instance is required.',\n      !!(page && typeof page === 'object')\n    );\n\n    this.attachToPageEvents(page);\n  }\n\n  onDisconnect() {\n    this[LISTENERS].forEach((_, target) =>\n      this._callListenersWith('removeListener', target)\n    );\n  }\n\n  attachToPageEvents(page) {\n    const { requestResourceTypes } = this.options;\n\n    this[LISTENERS].set(page, {\n      request: async (request) => {\n        if (requestResourceTypes.includes(request.resourceType())) {\n          const url = request.url();\n          const method = request.method();\n          const headers = request.headers();\n\n          // A CORS preflight request is a CORS request that checks to see\n          // if the CORS protocol is understood.\n          const isPreFlightReq =\n            method === 'OPTIONS' &&\n            !!headers['origin'] &&\n            !!headers['access-control-request-method'];\n\n          // Do not intercept requests with the Polly passthrough QP\n          if (url.includes(PASSTHROUGH_REQ_ID_QP)) {\n            const parsedUrl = new URL(url, true);\n\n            // If this is a polly passthrough request\n            // Get the associated promise object for the request id and set it\n            // on the request.\n            if (!isPreFlightReq) {\n              this._requestsMapping.passthroughs.set(\n                request,\n                this[PASSTHROUGH_PROMISES].get(\n                  parsedUrl.query[PASSTHROUGH_REQ_ID_QP]\n                )\n              );\n            }\n\n            // Delete the query param to remove any pollyjs footprint\n            delete parsedUrl.query[PASSTHROUGH_REQ_ID_QP];\n\n            // Continue the request with the url override\n            request.continue({ url: parsedUrl.toString() });\n          } else if (isPreFlightReq) {\n            // Do not intercept preflight requests\n            request.continue();\n          } else {\n            this.handleRequest({\n              headers,\n              url,\n              method,\n              body: request.postData(),\n              requestArguments: { request }\n            });\n          }\n        } else {\n          request.continue();\n        }\n      },\n      requestfinished: (request) => {\n        const response = request.response();\n        const { passthroughs, pollyRequests } = this._requestsMapping;\n\n        // Resolve the passthrough promise with the response if it exists\n        if (passthroughs.has(request)) {\n          passthroughs.get(request).resolve(response);\n          passthroughs.delete(request);\n        }\n\n        // Resolve the deferred pollyRequest promise if it exists\n        if (pollyRequests.has(request)) {\n          pollyRequests.get(request).promise._resolve(response);\n          pollyRequests.delete(request);\n        }\n      },\n      requestfailed: (request) => {\n        const error = request.failure();\n        const { passthroughs, pollyRequests } = this._requestsMapping;\n\n        // Reject the passthrough promise with the error object if it exists\n        if (passthroughs.has(request)) {\n          passthroughs.get(request).reject(error);\n          passthroughs.delete(request);\n        }\n\n        // Reject the deferred pollyRequest promise with the error object if it exists\n        if (pollyRequests.has(request)) {\n          pollyRequests.get(request).promise._reject(error);\n          pollyRequests.delete(request);\n        }\n      },\n      close: () => this[LISTENERS].delete(page)\n    });\n\n    this._callListenersWith('prependListener', page);\n  }\n\n  onRequest(pollyRequest) {\n    const { request } = pollyRequest.requestArguments;\n    const { promise } = pollyRequest;\n\n    // Override the deferred promise's resolve and reject to no-op since\n    // we handle it manually in the `requestfinished` and `requestfailed` events.\n    promise._resolve = promise.resolve;\n    promise._reject = promise.reject;\n    promise.resolve = promise.reject = () => {};\n\n    /*\n      Create an access point to the `pollyRequest` so it can be accessed from\n      the emitted page events\n    */\n    this._requestsMapping.pollyRequests.set(request, pollyRequest);\n  }\n\n  async onFetchResponse(pollyRequest) {\n    const { page } = this.options;\n    const { id, order, url, method, headers, body } = pollyRequest;\n    const requestId = `${this.polly.recordingId}:${id}:${order}`;\n    const parsedUrl = new URL(url, true);\n\n    parsedUrl.query[PASSTHROUGH_REQ_ID_QP] = requestId;\n\n    try {\n      const response = await new Promise((resolve, reject) => {\n        this[PASSTHROUGH_PROMISES].set(requestId, { resolve, reject });\n\n        // This gets evaluated within the browser's context, meaning that\n        // this fetch call executes from within the browser.\n        page.evaluate(\n          new Function(\n            'url',\n            'method',\n            'headers',\n            'body',\n            'return fetch(url, { method, headers, body });'\n          ),\n          parsedUrl.toString(),\n          method,\n          headers,\n          body\n        );\n      });\n\n      return {\n        statusCode: response.status(),\n        headers: response.headers(),\n        body: await response.text()\n      };\n    } finally {\n      this[PASSTHROUGH_PROMISES].delete(requestId);\n    }\n  }\n\n  async onRespond(pollyRequest, error) {\n    const { request } = pollyRequest.requestArguments;\n    const { response } = pollyRequest;\n\n    if (error) {\n      // If an error was returned then we force puppeteer to abort the current\n      // request. This will emit the `requestfailed` page event and allow the end\n      // user to handle the error.\n      await request.abort();\n    } else {\n      await request.respond({\n        status: response.statusCode,\n        headers: response.headers,\n        body: response.body\n      });\n    }\n  }\n\n  _callListenersWith(methodName, target) {\n    if (this[LISTENERS].has(target)) {\n      const listeners = this[LISTENERS].get(target);\n\n      // puppeteer remove prependListener after v4.0.0, polyfill it if missing\n      const prependListenerPolyfill = function (event, handler) {\n        const all = this.emitter.all;\n        const handlers = all.get(event);\n        const added = handlers && handlers.unshift(handler);\n\n        if (!added) {\n          all.set(event, [handler]);\n        }\n      };\n\n      for (const eventName in listeners) {\n        const prependListener =\n          target.prependListener || prependListenerPolyfill;\n        const fn =\n          methodName === 'prependListener'\n            ? prependListener\n            : target[methodName];\n\n        fn.apply(target, [eventName, listeners[eventName]]);\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/helpers/fetch.js",
    "content": "import { Response } from 'node-fetch';\n\nexport default async function fetch() {\n  const res = await this.page.evaluate((...args) => {\n    // This is run within the browser's context meaning it's using the\n    // browser's native window.fetch method.\n    return fetch(...args).then((res) => {\n      const { url, status, headers } = res;\n\n      return res.text().then((body) => {\n        return { url, status, body, headers };\n      });\n    });\n  }, ...arguments);\n\n  return new Response(res.body, res);\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/integration/adapter-test.js",
    "content": "import InMemoryPersister from '@pollyjs/persister-in-memory';\nimport puppeteer from 'puppeteer';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport adapterTests from '@pollyjs-tests/integration/adapter-tests';\nimport { setupMocha as setupPolly } from '@pollyjs/core';\n\nimport fetch from '../helpers/fetch';\nimport PuppeteerAdapter from '../../src';\n\n// The host the API server is on\nconst HOST = 'http://localhost:4000';\n\ndescribe('Integration | Puppeteer Adapter', function () {\n  before(async function () {\n    this.browser = await puppeteer.launch({ args: ['--no-sandbox'] });\n  });\n\n  after(async function () {\n    await this.browser.close();\n  });\n\n  setupPolly.beforeEach({\n    recordFailedRequests: true,\n    persister: InMemoryPersister,\n    matchRequestsBy: {\n      headers: {\n        exclude: [\n          // We don't want new recordings when we update chrome\n          'user-agent',\n          // This is a unique ID which breaks the request matching\n          'x-devtools-emulate-network-conditions-client-id'\n        ]\n      }\n    }\n  });\n\n  setupFetchRecord.beforeEach({ host: HOST });\n\n  beforeEach(function () {\n    // Override this.fetch here since it needs access to the current context\n    this.fetch = fetch.bind(this);\n  });\n\n  beforeEach(async function () {\n    this.page = await this.browser.newPage();\n\n    await this.page.goto(`${HOST}/api`);\n    await this.page.setRequestInterception(true);\n\n    this.polly.configure({\n      adapters: [PuppeteerAdapter],\n      adapterOptions: {\n        puppeteer: { page: this.page }\n      }\n    });\n  });\n\n  afterEach(async function () {\n    // Turn off request interception before setupFetchRecord's afterEach so it\n    // can correctly do it's thing\n    await this.page.setRequestInterception(false);\n  });\n\n  setupFetchRecord.afterEach();\n\n  afterEach(async function () {\n    await this.page.close();\n  });\n\n  setupPolly.afterEach();\n\n  adapterTests();\n\n  it('should have resolved requests after flushing', async function () {\n    // Timeout after 500ms since we could have a hanging while loop\n    this.timeout(500);\n\n    const { server } = this.polly;\n    const requests = [];\n    const resolved = [];\n    let i = 1;\n\n    server\n      .get(this.recordUrl())\n      .intercept(async (req, res) => {\n        await server.timeout(5);\n        res.sendStatus(200);\n      })\n      .on('request', (req) => requests.push(req));\n\n    this.page.on('requestfinished', () => resolved.push(i++));\n\n    this.fetchRecord();\n    this.fetchRecord();\n    this.fetchRecord();\n\n    // Since it takes time for Puppeteer to execute the request in the browser's\n    // context, we have to wait until the requests have been made.\n    while (requests.length !== 3) {\n      await server.timeout(5);\n    }\n\n    await this.polly.flush();\n\n    expect(requests).to.have.lengthOf(3);\n    requests.forEach((request) => expect(request.didRespond).to.be.true);\n    expect(resolved).to.have.members([1, 2, 3]);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/tests/unit/adapter-test.js",
    "content": "import { setupMocha as setupPolly } from '@pollyjs/core';\nimport { PollyError } from '@pollyjs/utils';\n\nimport PuppeteerAdapter from '../../src';\n\ndescribe('Unit | Puppeteer Adapter', function () {\n  setupPolly();\n\n  it('should throw without a page instance', function () {\n    expect(() =>\n      this.polly.configure({\n        adapters: [PuppeteerAdapter]\n      })\n    ).to.throw(PollyError, /A puppeteer page instance is required/);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-puppeteer/types.d.ts",
    "content": "import Adapter from '@pollyjs/adapter';\n\nexport default class PuppeteerAdapter extends Adapter<{\n  page: any;\n  requestResourceTypes?: string[];\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n\n### Bug Fixes\n\n* Handle failed arraybuffer instanceof checks ([#393](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/393)) ([247be0a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/247be0a))\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [5.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v5.0.0...v5.0.1) (2020-09-25)\n\n\n### Bug Fixes\n\n* **adapter-xhr:** Only modify the `responseType` if it was changed ([#363](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/363)) ([cff4e2d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/cff4e2d))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/48ea1d7))\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/cc46bb4))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Features\n\n* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/5a6fda6))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n\n### Features\n\n* **adapter-xhr:** Support `context` option ([65b3c38](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/65b3c38))\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n\n### Bug Fixes\n\n* **adapter-xhr:** Xhr.send should not be an async method ([#173](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/173)) ([eb3a6eb](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/eb3a6eb))\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Simplify adapter implementation ([#154](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/154)) ([12c8601](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/12c8601))\n\n\n### BREAKING CHANGES\n\n* Changes to the base adapter implementation and external facing API\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Features\n\n* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/140)) ([548002c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/548002c))\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/79cdd96))\n\n\n\n\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/@pollyjs/adapter-xhr@1.0.4...@pollyjs/adapter-xhr@1.0.5) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/@pollyjs/adapter-xhr@1.0.3...@pollyjs/adapter-xhr@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/@pollyjs/adapter-xhr@1.0.2...@pollyjs/adapter-xhr@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/@pollyjs/adapter-xhr@1.0.1...@pollyjs/adapter-xhr@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/compare/@pollyjs/adapter-xhr@1.0.0...@pollyjs/adapter-xhr@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/adapter-xhr\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n### Bug Fixes\n\n* Loosen up global XHR native check ([#69](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/adapter-xhr/issues/69)) ([79cdd96](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr/commit/79cdd96))\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fadapter-xhr.svg)](https://badge.fury.io/js/%40pollyjs%2Fadapter-xhr)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/adapter-xhr` package provides an xhr adapter that uses\nSinon's [Nise](https://github.com/sinonjs/nise) library to fake the global\n`XMLHttpRequest` object while wrapping the native one to allow for seamless\nrecording and replaying of requests.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/adapter-xhr -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/adapter-xhr -D\n```\n\n## Documentation\n\nCheck out the [XHR Adapter](https://netflix.github.io/pollyjs/#/adapters/xhr)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\n\nPolly.register(XHRAdapter);\n\nnew Polly('<Recording Name>', {\n  adapters: ['xhr']\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/package.json",
    "content": "{\n  \"name\": \"@pollyjs/adapter-xhr\",\n  \"version\": \"6.0.6\",\n  \"description\": \"XHR adapter for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-adapter-xhr.js\",\n  \"module\": \"dist/es/pollyjs-adapter-xhr.js\",\n  \"browser\": \"dist/umd/pollyjs-adapter-xhr.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-xhr\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"xhr\",\n    \"adapter\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"build:watch\": \"yarn build -w\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@offirgolan/nise\": \"^4.1.0\",\n    \"@pollyjs/adapter\": \"^6.0.6\",\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"to-arraybuffer\": \"^1.0.1\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/core\": \"^6.0.6\",\n    \"@pollyjs/persister-rest\": \"^6.0.6\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/rollup.config.test.js",
    "content": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/index.js",
    "content": "import fakeXhr from '@offirgolan/nise/lib/fake-xhr';\nimport Adapter from '@pollyjs/adapter';\nimport { cloneArrayBuffer, isBufferUtf8Representable } from '@pollyjs/utils';\nimport { Buffer } from 'buffer/';\nimport bufferToArrayBuffer from 'to-arraybuffer';\n\nimport resolveXhr from './utils/resolve-xhr';\nimport serializeResponseHeaders from './utils/serialize-response-headers';\n\nconst SEND = Symbol();\nconst ABORT_HANDLER = Symbol();\nconst stubbedXhrs = new WeakSet();\n\nconst BINARY_RESPONSE_TYPES = ['arraybuffer', 'blob'];\n\nexport default class XHRAdapter extends Adapter {\n  static get id() {\n    return 'xhr';\n  }\n\n  get defaultOptions() {\n    return {\n      context: global\n    };\n  }\n\n  onConnect() {\n    const { context } = this.options;\n    const fakeXhrForContext = fakeXhr.fakeXMLHttpRequestFor(context);\n\n    this.assert('XHR global not found.', fakeXhrForContext.xhr.supportsXHR);\n    this.assert(\n      'Running concurrent XHR adapters is unsupported, stop any running Polly instances.',\n      !stubbedXhrs.has(context.XMLHttpRequest)\n    );\n\n    this.NativeXMLHttpRequest = context.XMLHttpRequest;\n    this.xhr = fakeXhrForContext.useFakeXMLHttpRequest();\n\n    this.xhr.onCreate = (xhr) => {\n      xhr[SEND] = xhr.send;\n      xhr.send = (body) => {\n        xhr[SEND](body);\n        this.handleRequest({\n          url: xhr.url,\n          method: xhr.method || 'GET',\n          headers: xhr.requestHeaders,\n          requestArguments: { xhr },\n          body\n        });\n      };\n    };\n\n    stubbedXhrs.add(context.XMLHttpRequest);\n  }\n\n  onDisconnect() {\n    const { context } = this.options;\n\n    stubbedXhrs.delete(context.XMLHttpRequest);\n    this.xhr.restore();\n  }\n\n  onRequest(pollyRequest) {\n    const { xhr } = pollyRequest.requestArguments;\n\n    if (xhr.aborted) {\n      pollyRequest.abort();\n    } else {\n      pollyRequest[ABORT_HANDLER] = () => pollyRequest.abort();\n      xhr.addEventListener('abort', pollyRequest[ABORT_HANDLER]);\n    }\n  }\n\n  async onFetchResponse(pollyRequest) {\n    const { xhr: fakeXhr } = pollyRequest.requestArguments;\n    const xhr = new this.NativeXMLHttpRequest();\n\n    xhr.open(\n      pollyRequest.method,\n      pollyRequest.url,\n      fakeXhr.async,\n      fakeXhr.username,\n      fakeXhr.password\n    );\n\n    xhr.async = fakeXhr.async;\n\n    if (BINARY_RESPONSE_TYPES.includes(fakeXhr.responseType)) {\n      xhr.responseType = 'arraybuffer';\n    }\n\n    if (fakeXhr.async) {\n      xhr.timeout = fakeXhr.timeout;\n      xhr.withCredentials = fakeXhr.withCredentials;\n    }\n\n    for (const h in pollyRequest.headers) {\n      xhr.setRequestHeader(h, pollyRequest.headers[h]);\n    }\n\n    await resolveXhr(xhr, pollyRequest.body);\n\n    let body = xhr.response;\n    let isBinary = false;\n\n    // responseType will either be `arraybuffer` or `text`\n    if (xhr.responseType === 'arraybuffer') {\n      let arrayBuffer = xhr.response;\n\n      /*\n        If the returned array buffer is not an instance of the global ArrayBuffer,\n        clone it in order to pass Buffer.from's instanceof check. This can happen\n        when using this adapter with a different context.\n\n        https://github.com/feross/buffer/issues/289\n      */\n      if (\n        arrayBuffer &&\n        !(arrayBuffer instanceof ArrayBuffer) &&\n        'byteLength' in arrayBuffer\n      ) {\n        arrayBuffer = cloneArrayBuffer(arrayBuffer);\n      }\n\n      const buffer = Buffer.from(arrayBuffer);\n\n      isBinary = !isBufferUtf8Representable(buffer);\n      body = buffer.toString(isBinary ? 'base64' : 'utf8');\n    }\n\n    return {\n      statusCode: xhr.status,\n      headers: serializeResponseHeaders(xhr.getAllResponseHeaders()),\n      encoding: isBinary ? 'base64' : undefined,\n      body\n    };\n  }\n\n  onRespond(pollyRequest, error) {\n    const { xhr } = pollyRequest.requestArguments;\n\n    if (pollyRequest[ABORT_HANDLER]) {\n      xhr.removeEventListener('abort', pollyRequest[ABORT_HANDLER]);\n    }\n\n    if (pollyRequest.aborted) {\n      return;\n    } else if (error) {\n      // If an error was received then call the `error` method on the fake XHR\n      // request provided by nise which will simulate a network error on the request.\n      // The onerror handler will be called and the status will be 0.\n      // https://github.com/sinonjs/nise/blob/v1.4.10/lib/fake-xhr/index.js#L614-L621\n      xhr.error();\n    } else {\n      const { statusCode, headers, body, encoding } = pollyRequest.response;\n      let responseBody = body;\n\n      if (encoding) {\n        const buffer = Buffer.from(body, encoding);\n\n        if (BINARY_RESPONSE_TYPES.includes(xhr.responseType)) {\n          responseBody = bufferToArrayBuffer(buffer);\n        } else {\n          responseBody = buffer.toString('utf8');\n        }\n      }\n\n      xhr.respond(statusCode, headers, responseBody);\n    }\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/utils/resolve-xhr.js",
    "content": "export default function resolveXhr(xhr, body) {\n  return new Promise((resolve) => {\n    xhr.send(body);\n\n    if (xhr.async) {\n      const { onreadystatechange } = xhr;\n\n      xhr.onreadystatechange = (...args) => {\n        onreadystatechange && onreadystatechange.apply(xhr, ...args);\n        xhr.readyState === XMLHttpRequest.DONE && resolve();\n      };\n    } else {\n      resolve();\n    }\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/src/utils/serialize-response-headers.js",
    "content": "/**\n * Serialize response headers which is received as a string, into a pojo\n *\n * @param {String} responseHeaders\n */\nexport default function serializeResponseHeaders(responseHeaders) {\n  if (typeof responseHeaders !== 'string') {\n    return responseHeaders;\n  }\n\n  return responseHeaders.split('\\n').reduce((headers, header) => {\n    const [key, value] = header.split(':');\n\n    if (key) {\n      headers[key] = value.replace(/(\\r|\\n|^\\s+)/g, '');\n    }\n\n    return headers;\n  }, {});\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/tests/integration/adapter-test.js",
    "content": "import { Polly, setupMocha as setupPolly } from '@pollyjs/core';\nimport setupFetchRecord from '@pollyjs-tests/helpers/setup-fetch-record';\nimport adapterTests from '@pollyjs-tests/integration/adapter-tests';\nimport adapterBrowserTests from '@pollyjs-tests/integration/adapter-browser-tests';\nimport adapterIdentifierTests from '@pollyjs-tests/integration/adapter-identifier-tests';\nimport InMemoryPersister from '@pollyjs/persister-in-memory';\nimport { Buffer } from 'buffer/';\n\nimport xhrRequest from '../utils/xhr-request';\nimport XHRAdapter from '../../src';\n\nclass MockXMLHttpRequest {}\n\ndescribe('Integration | XHR Adapter', function () {\n  setupPolly.beforeEach({\n    recordFailedRequests: true,\n    adapters: [XHRAdapter],\n    persister: InMemoryPersister\n  });\n\n  setupFetchRecord({ fetch: xhrRequest });\n  setupPolly.afterEach();\n\n  adapterTests();\n  adapterBrowserTests();\n  adapterIdentifierTests();\n\n  it('should handle aborting a request', async function () {\n    const { server } = this.polly;\n    const xhr = new XMLHttpRequest();\n    let abortEventCalled;\n\n    server\n      .any(this.recordUrl())\n      .on('request', () => xhr.abort())\n      .on('abort', () => (abortEventCalled = true))\n      .intercept((_, res) => {\n        res.sendStatus(200);\n      });\n\n    await this.fetchRecord({ xhr });\n    await this.polly.flush();\n\n    expect(abortEventCalled).to.equal(true);\n  });\n\n  it('should handle immediately aborting a request', async function () {\n    const { server } = this.polly;\n    const xhr = new XMLHttpRequest();\n    let abortEventCalled;\n\n    server\n      .any(this.recordUrl())\n      .on('abort', () => (abortEventCalled = true))\n      .intercept((_, res) => {\n        res.sendStatus(200);\n      });\n\n    const promise = this.fetchRecord({ xhr });\n\n    xhr.abort();\n    await promise;\n    await this.polly.flush();\n\n    expect(abortEventCalled).to.equal(true);\n  });\n\n  ['arraybuffer', 'blob', 'text'].forEach((responseType) =>\n    it(`should be able to download binary content (${responseType})`, async function () {\n      const fetch = async () =>\n        Buffer.from(\n          await this.fetch('/assets/32x32.png', {\n            responseType\n          }).then((res) => res.arrayBuffer())\n        );\n\n      this.polly.disconnectFrom(XHRAdapter);\n\n      const nativeResponseBuffer = await fetch();\n\n      this.polly.connectTo(XHRAdapter);\n\n      const recordedResponseBuffer = await fetch();\n\n      const { recordingName, config } = this.polly;\n\n      await this.polly.stop();\n      this.polly = new Polly(recordingName, config);\n      this.polly.replay();\n\n      const replayedResponseBuffer = await fetch();\n\n      expect(nativeResponseBuffer.equals(recordedResponseBuffer)).to.equal(\n        true\n      );\n      expect(recordedResponseBuffer.equals(replayedResponseBuffer)).to.equal(\n        true\n      );\n      expect(nativeResponseBuffer.equals(replayedResponseBuffer)).to.equal(\n        true\n      );\n    })\n  );\n});\n\ndescribe('Integration | XHR Adapter | Init', function () {\n  describe('Context', function () {\n    it(`should assign context's XMLHttpRequest as the native XMLHttpRequest`, async function () {\n      const polly = new Polly('context', { adapters: [] });\n      const adapterOptions = {\n        xhr: {\n          context: { XMLHttpRequest: MockXMLHttpRequest }\n        }\n      };\n\n      polly.configure({\n        adapters: [XHRAdapter],\n        adapterOptions\n      });\n\n      expect(polly.adapters.get('xhr').NativeXMLHttpRequest).to.equal(\n        MockXMLHttpRequest\n      );\n      expect(polly.adapters.get('xhr').NativeXMLHttpRequest).to.not.equal(\n        adapterOptions.xhr.context.XMLHttpRequest\n      );\n\n      expect(function () {\n        polly.configure({\n          adapterOptions: { xhr: { context: {} } }\n        });\n      }).to.throw(/XHR global not found/);\n\n      await polly.stop();\n    });\n  });\n\n  describe('Concurrency', function () {\n    it('should prevent concurrent XHR adapter instances on the same context', async function () {\n      const one = new Polly('one');\n      const two = new Polly('two');\n      const three = new Polly('three', {\n        adapterOptions: {\n          xhr: {\n            context: { XMLHttpRequest: MockXMLHttpRequest }\n          }\n        }\n      });\n\n      one.connectTo(XHRAdapter);\n\n      expect(function () {\n        two.connectTo(XHRAdapter);\n      }).to.throw(/Running concurrent XHR adapters is unsupported/);\n\n      three.connectTo(XHRAdapter);\n\n      await one.stop();\n      await two.stop();\n      await three.stop();\n    });\n\n    it('should allow you to register new instances once stopped', async function () {\n      const one = new Polly('one');\n      const two = new Polly('two');\n\n      one.connectTo(XHRAdapter);\n      await one.stop();\n\n      expect(function () {\n        two.connectTo(XHRAdapter);\n      }).to.not.throw();\n\n      await one.stop();\n      await two.stop();\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/tests/utils/xhr-request.js",
    "content": "import serializeResponseHeaders from '../../src/utils/serialize-response-headers';\n\nexport default function request(url, obj = {}) {\n  return new Promise((resolve) => {\n    const xhr = obj.xhr || new XMLHttpRequest();\n\n    xhr.open(obj.method || 'GET', url);\n\n    if (obj.headers) {\n      for (const h in obj.headers) {\n        xhr.setRequestHeader(h, obj.headers[h]);\n      }\n    }\n\n    if (obj.responseType) {\n      xhr.responseType = obj.responseType;\n    }\n\n    xhr.onreadystatechange = () =>\n      xhr.readyState === XMLHttpRequest.DONE && resolve(xhr);\n    xhr.onerror = () => resolve(xhr);\n\n    xhr.send(obj.body);\n  }).then((xhr) => {\n    const responseBody =\n      xhr.status === 204 && xhr.response === '' ? null : xhr.response;\n\n    return new Response(responseBody, {\n      status: xhr.status || 500,\n      statusText: xhr.statusText,\n      headers: serializeResponseHeaders(xhr.getAllResponseHeaders())\n    });\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/adapter-xhr/types.d.ts",
    "content": "import Adapter from '@pollyjs/adapter';\n\nexport default class XHRAdapter extends Adapter<{\n  context?: any;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/cli/.eslintrc.js",
    "content": "module.exports = {\n  parserOptions: {\n    sourceType: 'script',\n    ecmaVersion: 2020\n  },\n  env: {\n    browser: false,\n    node: true\n  },\n  plugins: ['node'],\n  extends: ['plugin:node/recommended']\n};\n"
  },
  {
    "path": "packages/@pollyjs/cli/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* Recording file name will no longer have trailing dashes\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [3.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v3.0.0...v3.0.1) (2019-12-25)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/cli\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Features\n\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/cli/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/commit/d4be431))\n\n\n\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@1.0.2...@pollyjs/cli@1.0.3) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@1.0.1...@pollyjs/cli@1.0.2) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@1.0.0...@pollyjs/cli@1.0.1) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@0.2.1...@pollyjs/cli@1.0.0) (2018-07-20)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n\n<a name=\"0.2.1\"></a>\n## [0.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@0.2.0...@pollyjs/cli@0.2.1) (2018-06-29)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@0.1.1...@pollyjs/cli@0.2.0) (2018-06-27)\n\n\n### Features\n\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/cli/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/commit/d4be431))\n\n\n\n\n<a name=\"0.1.1\"></a>\n## [0.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli/compare/@pollyjs/cli@0.1.0...@pollyjs/cli@0.1.1) (2018-06-21)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/cli\n"
  },
  {
    "path": "packages/@pollyjs/cli/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/cli/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fcli.svg)](https://badge.fury.io/js/%40pollyjs%2Fcli)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/cli` package provides a standalone CLI to quickly get you setup\nand ready to go.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/cli -g\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn global add @pollyjs/cli\n```\n\n## Documentation\n\nCheck out the [CLI](https://netflix.github.io/pollyjs/#/cli/overview)\ndocumentation for more details.\n\n## Usage\n\n```text\n  Usage: polly [options] [command]\n\n  Options:\n\n    -v, --version       output the version number\n    -h, --help          output usage information\n\n  Commands:\n\n    listen|l [options]  start the server and listen for requests\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/cli/bin/cli.js",
    "content": "#!/usr/bin/env node\n\n// Provide a title to the process in `ps`\nprocess.title = 'polly';\n\nconst Polly = require('@pollyjs/node-server');\nconst { program } = require('commander');\n\nconst version = require('../package.json').version;\n\nprogram.name('polly').version(version, '-v, --version');\n\nprogram\n  .command('listen')\n  .alias('l')\n  .description('start the server and listen for requests')\n  .option('-H, --host <host>', 'host')\n  .option('-p, --port <port>', 'port number', Polly.Defaults.port)\n  .option(\n    '-n, --api-namespace <namespace>',\n    'api namespace',\n    Polly.Defaults.apiNamespace\n  )\n  .option(\n    '-d, --recordings-dir <path>',\n    'recordings directory',\n    Polly.Defaults.recordingsDir\n  )\n  .option(\n    '-s, --recording-size-limit <limit>',\n    'recording size limit',\n    Polly.Defaults.recordingSizeLimit\n  )\n  .option('-q, --quiet', 'disable logging')\n  .action(function (options) {\n    new Polly.Server(options).listen();\n  });\n\nprogram.parse(process.argv);\n\n// if cli was called with no arguments, show help.\nif (program.args.length === 0) {\n  program.help();\n}\n"
  },
  {
    "path": "packages/@pollyjs/cli/package.json",
    "content": "{\n  \"name\": \"@pollyjs/cli\",\n  \"version\": \"6.0.6\",\n  \"description\": \"@pollyjs CLI\",\n  \"files\": [\n    \"bin\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/cli\",\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"cli\",\n    \"server\",\n    \"listen\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"@pollyjs/node-server\": \"^6.0.6\",\n    \"commander\": \"^8.3.0\"\n  },\n  \"devDependencies\": {\n    \"npm-run-all\": \"^4.1.5\",\n    \"rimraf\": \"^3.0.2\",\n    \"rollup\": \"^1.14.6\"\n  },\n  \"bin\": {\n    \"polly\": \"./bin/cli.js\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n\n### Bug Fixes\n\n* Update types for class methods ([#438](https://github.com/netflix/pollyjs/issues/438)) ([b88655a](https://github.com/netflix/pollyjs/commit/b88655ac1b4ca7348afd45e9aeaa50e998ea68d7))\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n\n### Bug Fixes\n\n* A few more type fixes ([#437](https://github.com/netflix/pollyjs/issues/437)) ([5e837a2](https://github.com/netflix/pollyjs/commit/5e837a25d28393b764cb66bcae0b29e9273eabe8))\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n\n### Bug Fixes\n\n* **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ([cc2fa19](https://github.com/netflix/pollyjs/commit/cc2fa197a5c0a5fdef4602c4a207d31f3e677897))\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* fix!: Upgrade url-parse (#426) ([c21ed04](https://github.com/netflix/pollyjs/commit/c21ed048ff9d87a3773458dcfb9758e4fa6582bf)), closes [#426](https://github.com/netflix/pollyjs/issues/426)\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* Upgrade url-version to 1.5.0+ to fix CVE-2021-27515. This change could alter the final url generated for a request. \n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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. \n* Recording file name will no longer have trailing dashes\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n\n### Features\n\n* **core:** Add `overrideRecordingName` and `configure` to public API ([#372](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/372)) ([cdbf513](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/cdbf513))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Bug Fixes\n\n* **core:** Compute order based on id and recording name ([#342](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/342)) ([42004d2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/42004d2))\n\n\n### Features\n\n* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/1223ba0))\n\n\n### BREAKING CHANGES\n\n* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id\n* **core:** A request's order is will now be computed based on its id and the recording name it will be persisted to.\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **core:** Add `flushRequestsOnStop` configuration option ([#335](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/335)) ([ab4a2e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/ab4a2e1))\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/329)) ([9466989](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/9466989))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Improve abort handling ([#320](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/320)) ([cc46bb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/cc46bb4))\n* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/8fd4d19))\n\n\n### Features\n\n* **persister:** Add `disableSortingHarEntries` option ([#321](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/321)) ([0003c0e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0003c0e))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### Bug Fixes\n\n* **core:** Disconnect from all adapters when `pause` is called ([#291](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/291)) ([5c655bf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5c655bf))\n\n\n### Features\n\n* **core:** Provide the request as an argument to matchRequestsBy methods ([#293](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/293)) ([4e3163f](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4e3163f))\n* **core:** Remove deprecated `recordIfExpired` option ([#295](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/295)) ([5fe991d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5fe991d))\n\n\n### BREAKING CHANGES\n\n* **core:** `recordIfExpired` is no longer supported, please use `expiryStrategy` instead.\n* **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.\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Features\n\n* **core:** Improved logging ([#217](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/217)) ([3e876a8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/3e876a8))\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/23a2127))\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n\n### Features\n\n* **core:** Improved control flow with `times` and `stopPropagation` ([#202](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/202)) ([2c8231e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/2c8231e))\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n\n### Features\n\n* **core:** Filter requests matched by a route handler ([#189](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/189)) ([5d57c32](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5d57c32))\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n\n### Features\n\n* Add `error` event and improve error handling ([#185](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/185)) ([3694ebc](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/3694ebc))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n\n### Features\n\n* **core:** Add removeHeader, removeHeaders, and allow empty headers ([#176](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/176)) ([1dfae5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/1dfae5a))\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5b07b26))\n\n\n*  feat(adapter-node-http): Use `nock` under the hood instead of custom implementation (#166) ([62374f4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/62374f4)), closes [#166](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/166)\n\n\n### BREAKING CHANGES\n\n* The node-http adapter no longer accepts the `transports` option\n* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Fix unhandled rejection if connection fails ([#160](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/160)) ([12fcfa7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/12fcfa7))\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n# [1.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.3.2...v1.4.0) (2018-12-07)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/core\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Bug Fixes\n\n* Support URL objects ([#139](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/139)) ([cf0d755](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/cf0d755))\n* **core:** Handle trailing slashes when generating route names ([#142](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/142)) ([19147f7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/19147f7))\n* **core:** Ignore `context` options from being deep merged ([#144](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/144)) ([2123d83](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/2123d83))\n* **core:** Support multiple handlers for same paths ([#141](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/141)) ([79e04b8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/79e04b8))\n\n\n### Features\n\n* **core:** Support custom functions in matchRequestsBy config options ([#138](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/138)) ([626a84c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/626a84c))\n* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/140)) ([548002c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/548002c))\n\n\n\n\n\n      <a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Changes self to global, rollup-plugin-node-globals makes isomorphic ([#54](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/54)) ([3811e9d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/3811e9d))\n* Correctly normalize relative URLs ([b9b23cd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/b9b23cd))\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/19fee5a))\n* Improve support for relative URLs ([#78](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/78)) ([2c0083e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/2c0083e)), closes [#76](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/76)\n* Proxy route.params onto the request instead of mutating req ([5bcd4f9](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/5bcd4f9))\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/53ad433))\n* **core:** Freeze request after emitting afterResponse. ([66a2b64](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/66a2b64))\n* **core:** Set `url` on the fetch Response object ([#44](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/44)) ([f5980cf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/f5980cf)), closes [#43](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/43)\n\n\n### Features\n\n* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4ebacb8))\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0a3d591))\n* Cleanup event handler logic + rename some event names ([78dbb5d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/78dbb5d))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/e622640))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/8bb313c))\n* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/82ebd09))\n* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/164dbac))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/29ed8e1))\n* Move more response methods to shared base class ([#74](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/74)) ([4f845e5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4f845e5))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0b47838))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/f902c6d))\n* Use status code 204 in place of 404. ([#5](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/5)) ([930c492](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/930c492))\n* **core:** Add `json` property to `Request` ([bb8e1cb](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/bb8e1cb)), closes [#7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/7)\n* **core:** Default `Response` status code to 200 ([f42a281](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/f42a281)), closes [#6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/6)\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/a3113b7))\n* **core:** Normalize headers by lower-casing all keys ([#42](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/42)) ([02a4767](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/02a4767))\n* **core:** Server level configuration ([#80](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/80)) ([0f32d9b](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0f32d9b))\n* **persister:** Add `keepUnusedRequests` config option ([#108](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/108)) ([3f5f5b2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/3f5f5b2))\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/a04d7a7))\n\n\n### Reverts\n\n* Add `json` property to `Request` ([4ea50e8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4ea50e8))\n\n\n### BREAKING CHANGES\n\n* __Adapters__\n\n```js\nimport { XHRAdapter, FetchAdapter } from '@pollyjs/core';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\nadapters: ['xhr', FetchAdapter]\n});\n```\n\n__Persister__\n\n```js\nimport { LocalStoragePersister, RESTPersister } from '@pollyjs/core';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\npersister: 'local-storage'\n});\n\npolly.configure({\npersister: RESTPersister\n});\n```\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n* **core:** With this change, request ids will resolve to a different hash meaning that users will have to rerecord.\n* Relative URLs will have different hashes and will\nrequire to re-record.\n\n\n\n\n      <a name=\"1.1.4\"></a>\n## [1.1.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@1.1.3...@pollyjs/core@1.1.4) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/core\n\n<a name=\"1.1.1\"></a>\n## [1.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@1.1.0...@pollyjs/core@1.1.1) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/core\n\n<a name=\"1.1.0\"></a>\n# [1.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@1.0.0...@pollyjs/core@1.1.0) (2018-07-26)\n\n\n### Bug Fixes\n\n* Improve support for relative URLs ([#78](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/78)) ([2c0083e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/2c0083e)), closes [#76](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/76)\n\n\n### Features\n\n* Move more response methods to shared base class ([#74](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/74)) ([4f845e5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4f845e5))\n* Wait for all handled requests to resolve via `.flush()` ([#75](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/75)) ([a3113b7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/a3113b7))\n\n\n\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@0.5.0...@pollyjs/core@1.0.0) (2018-07-20)\n\n\n### Bug Fixes\n\n* Changes self to global, rollup-plugin-node-globals makes isomorphic ([#54](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/54)) ([3811e9d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/3811e9d))\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/19fee5a))\n\n\n### Features\n\n* Abort and passthrough from an intercept ([#57](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/57)) ([4ebacb8](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/4ebacb8))\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0a3d591))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/e622640))\n* Fetch adapter support for `context` provided via adapterOptions ([#66](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/66)) ([82ebd09](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/82ebd09))\n* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/164dbac))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/0b47838))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/f902c6d))\n\n\n### BREAKING CHANGES\n\n* __Adapters__\n\n```js\nimport { XHRAdapter, FetchAdapter } from '@pollyjs/core';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\nadapters: ['xhr', FetchAdapter]\n});\n```\n\n__Persister__\n\n```js\nimport { LocalStoragePersister, RESTPersister } from '@pollyjs/core';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\npersister: 'local-storage'\n});\n\npolly.configure({\npersister: RESTPersister\n});\n```\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"0.5.0\"></a>\n# [0.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@0.4.0...@pollyjs/core@0.5.0) (2018-06-27)\n\n\n### Bug Fixes\n\n* **core:** Set `url` on the fetch Response object ([#44](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/44)) ([f5980cf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/f5980cf)), closes [#43](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/issues/43)\n\n\n### Features\n\n* **core:** Normalize headers by lower-casing all keys ([#42](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/42)) ([02a4767](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/02a4767))\n\n\n### BREAKING CHANGES\n\n* **core:** With this change, request ids will resolve to a different hash meaning that users will have to rerecord.\n\n\n\n\n<a name=\"0.4.0\"></a>\n# [0.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@0.3.0...@pollyjs/core@0.4.0) (2018-06-22)\n\n\n### Bug Fixes\n\n* Correctly normalize relative URLs ([b9b23cd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/b9b23cd))\n\n\n### BREAKING CHANGES\n\n* Relative URLs will have different hashes and will\nrequire to re-record.\n\n\n\n\n<a name=\"0.3.0\"></a>\n# [0.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@0.2.0...@pollyjs/core@0.3.0) (2018-06-21)\n\n\n### Features\n\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/core/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/a04d7a7))\n\n\n\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/@pollyjs/core@0.1.0...@pollyjs/core@0.2.0) (2018-06-16)\n\n\n### Features\n\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/commit/8bb313c))\n"
  },
  {
    "path": "packages/@pollyjs/core/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/core/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fcore.svg)](https://badge.fury.io/js/%40pollyjs%2Fcore)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nPolly.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.\n\n> Interested in contributing or just seeing Polly in action? Head over to [CONTRIBUTING.md](CONTRIBUTING.md) to learn how to spin up the project!\n\n## Why Polly?\n\nKeeping fixtures and factories in parity with your APIs can be a time consuming process.\nPolly alleviates this process by recording and maintaining actual server responses while also staying flexible.\n\n- Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.\n- Use Polly's client-side server to modify or intercept requests and responses to simulate different application states (e.g. loading, error, etc.).\n\n## Features\n\n- 🚀 Node & Browser Support\n- ⚡️️ Simple, Powerful, & Intuitive API\n- 💎 First Class Mocha & QUnit Test Helpers\n- 🔥 Intercept, Pass-Through, and Attach Events\n- 📼 Record to Disk or Local Storage\n- ⏱ Slow Down or Speed Up Time\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/core -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/core -D\n```\n\n## Getting Started\n\nCheck out the [Quick Start](https://netflix.github.io/pollyjs/#/quick-start) documentation to get started.\n\n## Usage\n\nLet's take a look at what an example test case would look like using Polly.\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\nimport RESTPersister from '@pollyjs/persister-rest';\n\n/*\n  Register the adapters and persisters we want to use. This way all future\n  polly instances can access them by name/id.\n*/\nPolly.register(XHRAdapter);\nPolly.register(FetchAdapter);\nPolly.register(RESTPersister);\n\ndescribe('Netflix Homepage', function () {\n  it('should be able to sign in', async function () {\n    /*\n      Create a new polly instance.\n\n      Connect Polly to both fetch and XHR browser APIs. By default, it will\n      record any requests that it hasn't yet seen while replaying ones it\n      has already recorded.\n    */\n    const polly = new Polly('Sign In', {\n      adapters: ['xhr', 'fetch'],\n      persister: 'rest'\n    });\n\n    const { server } = polly;\n\n    /* Intercept all Google Analytic requests and respond with a 200 */\n    server\n      .get('/google-analytics/*path')\n      .intercept((req, res) => res.sendStatus(200));\n\n    /* Pass-through all GET requests to /coverage */\n    server.get('/coverage').passthrough();\n\n    /* start: pseudo test code */\n    await visit('/login');\n    await fillIn('email', 'polly@netflix.com');\n    await fillIn('password', '@pollyjs');\n    await submit();\n    /* end: pseudo test code */\n\n    expect(location.pathname).to.equal('/browse');\n\n    /*\n      Calling `stop` will persist requests as well as disconnect from any\n      connected browser APIs (e.g. fetch or XHR).\n    */\n    await polly.stop();\n  });\n});\n```\n\nThe above test case would generate the following [HAR](http://www.softwareishard.com/blog/har-12-spec/)\nfile which Polly will use to replay the sign-in response when the test is rerun:\n\n```json\n{\n  \"log\": {\n    \"_recordingName\": \"Sign In\",\n    \"browser\": {\n      \"name\": \"Chrome\",\n      \"version\": \"67.0\"\n    },\n    \"creator\": {\n      \"name\": \"Polly.JS\",\n      \"version\": \"0.5.0\",\n      \"comment\": \"persister:rest\"\n    },\n    \"entries\": [\n      {\n        \"_id\": \"06f06e6d125cbb80896c41786f9a696a\",\n        \"_order\": 0,\n        \"cache\": {},\n        \"request\": {\n          \"bodySize\": 51,\n          \"cookies\": [],\n          \"headers\": [\n            {\n              \"name\": \"content-type\",\n              \"value\": \"application/json; charset=utf-8\"\n            }\n          ],\n          \"headersSize\": 97,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"method\": \"POST\",\n          \"postData\": {\n            \"mimeType\": \"application/json; charset=utf-8\",\n            \"text\": \"{\\\"email\\\":\\\"polly@netflix.com\\\",\\\"password\\\":\\\"@pollyjs\\\"}\"\n          },\n          \"queryString\": [],\n          \"url\": \"https://netflix.com/api/v1/login\"\n        },\n        \"response\": {\n          \"bodySize\": 0,\n          \"content\": {\n            \"mimeType\": \"text/plain; charset=utf-8\",\n            \"size\": 0\n          },\n          \"cookies\": [],\n          \"headers\": [],\n          \"headersSize\": 0,\n          \"httpVersion\": \"HTTP/1.1\",\n          \"redirectURL\": \"\",\n          \"status\": 200,\n          \"statusText\": \"OK\"\n        },\n        \"startedDateTime\": \"2018-06-29T17:31:55.348Z\",\n        \"time\": 11,\n        \"timings\": {\n          \"blocked\": -1,\n          \"connect\": -1,\n          \"dns\": -1,\n          \"receive\": 0,\n          \"send\": 0,\n          \"ssl\": -1,\n          \"wait\": 11\n        }\n      }\n    ],\n    \"pages\": [],\n    \"version\": \"1.2\"\n  }\n}\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/core/package.json",
    "content": "{\n  \"name\": \"@pollyjs/core\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Record, replay, and stub HTTP Interactions\",\n  \"main\": \"dist/cjs/pollyjs-core.js\",\n  \"module\": \"dist/es/pollyjs-core.js\",\n  \"browser\": \"dist/umd/pollyjs-core.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core\",\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"vcr\",\n    \"record\",\n    \"replay\",\n    \"recorder\",\n    \"test\",\n    \"mock\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"@sindresorhus/fnv1a\": \"^2.0.1\",\n    \"blueimp-md5\": \"^2.19.0\",\n    \"fast-json-stable-stringify\": \"^2.1.0\",\n    \"is-absolute-url\": \"^3.0.3\",\n    \"lodash-es\": \"^4.17.21\",\n    \"loglevel\": \"^1.8.0\",\n    \"route-recognizer\": \"^0.3.4\",\n    \"slugify\": \"^1.6.3\"\n  },\n  \"devDependencies\": {\n    \"@pollyjs/adapter\": \"^6.0.6\",\n    \"@pollyjs/persister\": \"^6.0.6\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createNodeTestConfig(), createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/container.js",
    "content": "import { assert } from '@pollyjs/utils';\n\nfunction keyFor(Factory) {\n  return `${Factory.type}:${Factory.id}`;\n}\n\nexport class Container {\n  constructor() {\n    this._registry = new Map();\n  }\n\n  /**\n   * Register a factory onto the container.\n   *\n   * @param {Function} Factory\n   */\n  register(Factory) {\n    assert(\n      `Attempted to register ${Factory} but invalid factory provided. Expected function, received: \"${typeof Factory}\"`,\n      typeof Factory === 'function'\n    );\n\n    const { type } = Factory;\n    const name = Factory.id;\n\n    assert(\n      `Invalid registration id provided. Expected string, received: \"${typeof name}\"`,\n      typeof name === 'string'\n    );\n\n    assert(\n      `Invalid registration type provided. Expected string, received: \"${typeof type}\"`,\n      typeof type === 'string'\n    );\n\n    this._registry.set(keyFor(Factory), Factory);\n  }\n\n  /**\n   * Unregister a factory from the container via a key (e.g. `adapter:fetch`)\n   * or Factory class.\n   *\n   * @param {String|Function} keyOrFactory\n   */\n  unregister(keyOrFactory) {\n    const { _registry: registry } = this;\n    const key =\n      typeof keyOrFactory === 'function' ? keyFor(keyOrFactory) : keyOrFactory;\n\n    registry.delete(key);\n  }\n\n  /**\n   * Lookup a factory by the given key (e.g. `adapter:fetch`)\n   *\n   * @param {String} key\n   * @returns {Function}\n   */\n  lookup(key) {\n    return this._registry.get(key) || null;\n  }\n\n  /**\n   * Check if a factory has been registered via a key (e.g. `adapter:fetch`)\n   * or Factory class.\n   *\n   * @param {String|Function} keyOrFactory\n   * @returns {Boolean}\n   */\n  has(keyOrFactory) {\n    const { _registry: registry } = this;\n    const key =\n      typeof keyOrFactory === 'function' ? keyFor(keyOrFactory) : keyOrFactory;\n\n    return registry.has(key);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/event-emitter.js",
    "content": "import { assert } from '@pollyjs/utils';\nimport isObjectLike from 'lodash-es/isObjectLike';\n\nimport cancelFnAfterNTimes from '../utils/cancel-fn-after-n-times';\nimport { validateTimesOption } from '../utils/validators';\n\nimport Event from './event';\n\nconst EVENTS = Symbol();\nconst EVENT_NAMES = Symbol();\n\nfunction assertEventName(eventName, eventNames) {\n  assert(\n    `Invalid event name provided. Expected string, received: \"${typeof eventName}\".`,\n    typeof eventName === 'string'\n  );\n\n  assert(\n    `Invalid event name provided: \"${eventName}\". Possible events: ${[\n      ...eventNames\n    ].join(', ')}.`,\n    eventNames.has(eventName)\n  );\n}\n\nfunction assertListener(listener) {\n  assert(\n    `Invalid listener provided. Expected function, received: \"${typeof listener}\".`,\n    typeof listener === 'function'\n  );\n}\n\nexport default class EventEmitter {\n  /**\n   * @constructor\n   * @param {Object} options\n   * @param {String[]} options.eventNames - Supported events\n   */\n  constructor(options = {}) {\n    const { eventNames } = options;\n\n    assert(\n      'An array of supported events must be provided via the `eventNames` option.',\n      Array.isArray(eventNames) && eventNames.length > 0\n    );\n\n    this[EVENTS] = new Map();\n    this[EVENT_NAMES] = new Set(eventNames);\n  }\n\n  /**\n   * Returns an array listing the events for which the emitter has\n   * registered listeners\n   *\n   * @returns {String[]}\n   */\n  eventNames() {\n    const eventNames = [];\n\n    this[EVENTS].forEach(\n      (_, eventName) =>\n        this.hasListeners(eventName) && eventNames.push(eventName)\n    );\n\n    return eventNames;\n  }\n\n  /**\n   * Adds the `listener` function to the end of the listeners array for the\n   * event named `eventName`\n   *\n   * @param {String} eventName - The name of the event\n   * @param {Function} listener - The callback function\n   * @param {Object} [options={}]\n   * @param {Number} options.times - listener will be cancelled after this many times\n   * @returns {EventEmitter}\n   */\n  on(eventName, listener, options = {}) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n    assertListener(listener);\n\n    const events = this[EVENTS];\n    const { times } = options;\n\n    if (!events.has(eventName)) {\n      events.set(eventName, new Set());\n    }\n\n    if (times) {\n      validateTimesOption(times);\n\n      const tempListener = cancelFnAfterNTimes(listener, times, () =>\n        this.off(eventName, tempListener)\n      );\n\n      /*\n        Remove any existing listener or tempListener that match this one.\n\n        For example, if the following would get called:\n          this.on('request', listener);\n          this.on('request', listener, { times: 1 });\n\n        We want to make sure that there is only one instance of the given\n        listener for the given event.\n      */\n      this.off(eventName, listener);\n\n      // Save the original listener on the temp one so we can easily match it\n      // given the original.\n      tempListener.listener = listener;\n      listener = tempListener;\n    }\n\n    events.get(eventName).add(listener);\n\n    return this;\n  }\n\n  /**\n   * Adds a one-time `listener` function for the event named `eventName`.\n   * The next time `eventName` is triggered, this listener is removed and\n   * then invoked.\n   *\n   * @param {String} eventName - The name of the event\n   * @param {Function} listener - The callback function\n   * @param {Object} [options={}]\n   * @returns {EventEmitter}\n   */\n  once(eventName, listener, options = {}) {\n    this.on(eventName, listener, { ...options, times: 1 });\n\n    return this;\n  }\n\n  /**\n   * Removes the specified `listener` from the listener array for\n   * the event named `eventName`. If `listener` is not provided then it removes\n   * all listeners, or those of the specified `eventName`.\n   *\n   * @param {String} eventName - The name of the event\n   * @param {Function} [listener] - The callback function\n   * @returns {EventEmitter}\n   */\n  off(eventName, listener) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    const events = this[EVENTS];\n\n    if (this.hasListeners(eventName)) {\n      if (typeof listener === 'function') {\n        events.get(eventName).delete(listener);\n\n        // Remove any temp listeners that use the provided listener\n        this.listeners(eventName).forEach((l) => {\n          if (l.listener === listener) {\n            events.get(eventName).delete(l);\n          }\n        });\n      } else {\n        events.get(eventName).clear(eventName);\n      }\n    }\n\n    return this;\n  }\n\n  /**\n   * Returns a copy of the array of listeners for the event named `eventName`.\n   *\n   * @param {String} eventName - The name of the event\n   * @returns {Function[]}\n   */\n  listeners(eventName) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    return this.hasListeners(eventName) ? [...this[EVENTS].get(eventName)] : [];\n  }\n\n  /**\n   * Returns `true` if there are any listeners for the event named `eventName`\n   * or `false` otherwise.\n   *\n   * @param {String} eventName - The name of the event\n   * @returns {Boolean}\n   */\n  hasListeners(eventName) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    const events = this[EVENTS];\n\n    return events.has(eventName) && events.get(eventName).size > 0;\n  }\n\n  /**\n   * Asynchronously calls each of the `listeners` registered for the event named\n   * `eventName`, in the order they were registered, passing the supplied\n   * arguments to each.\n   *\n   * Returns a promise that will resolve to `false` if a listener stopped\n   * propagation, `true` otherwise.\n   *\n   * @async\n   * @param {String} eventName - The name of the event\n   * @param {any} ...args - The arguments to pass to the listeners\n   * @returns {Promise<Boolean>}\n   */\n  async emit(eventName, ...args) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    const event = new Event(eventName);\n\n    for (const listener of this.listeners(eventName)) {\n      await listener(...args, event);\n\n      if (event.shouldStopPropagating) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n\n  /**\n   * Asynchronously and concurrently calls each of the `listeners` registered\n   * for the event named `eventName`, in the order they were registered,\n   * passing the supplied arguments to each.\n   *\n   * Returns a promise that will resolve to `false` if a listener stopped\n   * propagation, `true` otherwise.\n   *\n   * @async\n   * @param {String} eventName - The name of the event\n   * @param {any} ...args - The arguments to pass to the listeners\n   * @returns {Promise<Boolean>}\n   */\n  async emitParallel(eventName, ...args) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    const event = new Event(eventName);\n\n    await Promise.all(\n      this.listeners(eventName).map((listener) => listener(...args, event))\n    );\n\n    if (event.shouldStopPropagating) {\n      return false;\n    }\n\n    return true;\n  }\n\n  /**\n   * Synchronously calls each of the `listeners` registered for the event named\n   * `eventName`, in the order they were registered, passing the supplied\n   * arguments to each.\n   *\n   * Throws if a listener's return value is promise-like.\n   *\n   * Returns`false` if a listener stopped propagation, `true` otherwise.\n   *\n   * @param {String} eventName - The name of the event\n   * @param {any} ...args - The arguments to pass to the listeners\n   * @returns {Boolean}\n   */\n  emitSync(eventName, ...args) {\n    assertEventName(eventName, this[EVENT_NAMES]);\n\n    const event = new Event(eventName);\n\n    for (const listener of this.listeners(eventName)) {\n      const returnValue = listener(...args, event);\n\n      assert(\n        `Attempted to emit a synchronous event \"${eventName}\" but an asynchronous listener was called.`,\n        !(isObjectLike(returnValue) && typeof returnValue.then === 'function')\n      );\n\n      if (event.shouldStopPropagating) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/event.js",
    "content": "import { assert } from '@pollyjs/utils';\n\nconst STOP_PROPAGATION = Symbol();\n\nexport default class Event {\n  constructor(type, props) {\n    assert(\n      `Invalid type provided. Expected a non-empty string, received: \"${typeof type}\".`,\n      type && typeof type === 'string'\n    );\n\n    Object.defineProperty(this, 'type', { value: type });\n    // eslint-disable-next-line no-restricted-properties\n    Object.assign(this, props || {});\n\n    this[STOP_PROPAGATION] = false;\n  }\n\n  stopPropagation() {\n    this[STOP_PROPAGATION] = true;\n  }\n\n  get shouldStopPropagating() {\n    return this[STOP_PROPAGATION];\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/http-base.js",
    "content": "import stringify from 'fast-json-stable-stringify';\n\nimport HTTPHeaders from '../utils/http-headers';\n\nconst { freeze } = Object;\nconst { parse } = JSON;\n\nexport default class HTTPBase {\n  constructor() {\n    this.headers = new HTTPHeaders();\n  }\n\n  getHeader(name) {\n    return this.headers[name];\n  }\n\n  setHeader(name, value) {\n    this.headers[name] = value;\n\n    return this;\n  }\n\n  setHeaders(headers = {}) {\n    for (const name in headers) {\n      this.setHeader(name, headers[name]);\n    }\n\n    return this;\n  }\n\n  removeHeader(name) {\n    this.setHeader(name, null);\n\n    return this;\n  }\n\n  removeHeaders(headers = []) {\n    for (const name of headers) {\n      this.removeHeader(name);\n    }\n\n    return this;\n  }\n\n  hasHeader(name) {\n    return !!this.getHeader(name);\n  }\n\n  type(type) {\n    return this.setHeader('Content-Type', type);\n  }\n\n  send(data) {\n    let body = data;\n\n    switch (typeof body) {\n      case 'string':\n        // String defaulting to html\n        if (!this.hasHeader('Content-Type')) {\n          this.type('text/html');\n        }\n\n        break;\n      case 'boolean':\n      case 'number':\n      case 'object':\n        if (body === null) {\n          body = '';\n        } else {\n          return this.json(body);\n        }\n\n        break;\n    }\n\n    if (typeof body === 'string') {\n      const contentType = this.getHeader('Content-Type');\n\n      // Write strings in utf-8\n      if (contentType && !contentType.includes('charset')) {\n        this.type(`${contentType}; charset=utf-8`);\n      }\n    }\n\n    this.body = body;\n\n    return this;\n  }\n\n  json(obj) {\n    if (!this.hasHeader('Content-Type')) {\n      this.type('application/json');\n    }\n\n    return this.send(stringify(obj));\n  }\n\n  jsonBody() {\n    return parse(this.body);\n  }\n\n  end() {\n    freeze(this);\n    freeze(this.headers);\n\n    return this;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/interceptor.js",
    "content": "import Event from './event';\n\nconst ABORT = Symbol();\nconst PASSTHROUGH = Symbol();\n\nfunction setDefaults(interceptor) {\n  interceptor[ABORT] = false;\n  interceptor[PASSTHROUGH] = false;\n}\n\nexport default class Interceptor extends Event {\n  constructor() {\n    super('intercept');\n    setDefaults(this);\n  }\n\n  abort() {\n    setDefaults(this);\n    this[ABORT] = true;\n  }\n\n  passthrough() {\n    setDefaults(this);\n    this[PASSTHROUGH] = true;\n  }\n\n  get shouldAbort() {\n    return this[ABORT];\n  }\n\n  get shouldPassthrough() {\n    return this[PASSTHROUGH];\n  }\n\n  get shouldIntercept() {\n    return !this.shouldAbort && !this.shouldPassthrough;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/logger.js",
    "content": "import { ACTIONS } from '@pollyjs/utils';\nimport logLevel from 'loglevel';\n\nconst FORMATTED_ACTIONS = {\n  [ACTIONS.RECORD]: 'Recorded',\n  [ACTIONS.REPLAY]: 'Replayed',\n  [ACTIONS.INTERCEPT]: 'Intercepted',\n  [ACTIONS.PASSTHROUGH]: 'Passthrough'\n};\n\nexport default class Logger {\n  constructor(polly) {\n    this.polly = polly;\n    this.log = logLevel.getLogger(`@pollyjs/core:${this.polly.recordingName}`);\n\n    this.log.setLevel(polly.config.logLevel);\n  }\n\n  connect() {\n    this._middleware = this.polly.server\n      .any()\n      .on('error', (...args) => this.logRequestError(...args))\n      .on('request', (...args) => this.logRequest(...args))\n      .on('response', (...args) => this.logRequestResponse(...args));\n  }\n\n  disconnect() {\n    this._middleware.off('error');\n    this._middleware.off('response');\n  }\n\n  logRequest(request) {\n    const { log } = request;\n    const debug = log.getLevel() <= log.levels.DEBUG;\n\n    log.info(\n      `Request: ${request.method} ${request.url}`,\n      ...(debug ? [{ request }] : [])\n    );\n  }\n\n  logRequestResponse(request, response) {\n    const { log } = request;\n    const debug = log.getLevel() <= log.levels.DEBUG;\n\n    log.info(\n      `Response: ${FORMATTED_ACTIONS[request.action]} ➞ ${request.method} ${\n        request.url\n      } ${response.statusCode} • ${request.responseTime}ms`,\n      ...(debug ? [{ request, response }] : [])\n    );\n  }\n\n  logRequestError(request, error) {\n    const { log } = request;\n    const debug = log.getLevel() <= log.levels.DEBUG;\n\n    log.error(\n      `Errored ➞ ${request.method} ${request.url}`,\n      error,\n      ...(debug ? [{ request }] : [])\n    );\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/request.js",
    "content": "import md5 from 'blueimp-md5';\nimport stringify from 'fast-json-stable-stringify';\nimport isAbsoluteUrl from 'is-absolute-url';\nimport { URL, assert, timestamp } from '@pollyjs/utils';\nimport logLevel from 'loglevel';\n\nimport NormalizeRequest from '../utils/normalize-request';\nimport parseUrl from '../utils/parse-url';\nimport guidForRecording from '../utils/guid-for-recording';\nimport mergeConfigs from '../utils/merge-configs';\nimport defer from '../utils/deferred-promise';\nimport {\n  validateRecordingName,\n  validateRequestConfig\n} from '../utils/validators';\n\nimport HTTPBase from './http-base';\nimport PollyResponse from './response';\nimport EventEmitter from './event-emitter';\nimport Interceptor from './interceptor';\n\nconst { keys, freeze } = Object;\n\nconst ROUTE = Symbol();\nconst POLLY = Symbol();\nconst PARSED_URL = Symbol();\nconst EVENT_EMITTER = Symbol();\n\nconst SUPPORTED_EVENTS = ['identify'];\n\nexport default class PollyRequest extends HTTPBase {\n  constructor(polly, request) {\n    super();\n\n    assert('Url is required.', request.url);\n    assert(\n      'Method is required.',\n      request.method && typeof request.method === 'string'\n    );\n\n    this.didRespond = false;\n    this.aborted = false;\n    this.url = request.url;\n    this.method = request.method.toUpperCase();\n    this.body = request.body;\n    this.setHeaders(request.headers);\n    this.recordingName = polly.recordingName;\n    this.recordingId = polly.recordingId;\n    this.requestArguments = freeze(request.requestArguments);\n    this.promise = defer();\n    this[POLLY] = polly;\n    this[EVENT_EMITTER] = new EventEmitter({ eventNames: SUPPORTED_EVENTS });\n\n    /*\n      The action taken with this request (e.g. record, replay, intercept, or passthrough)\n      This will be set by the adapter.\n    */\n    this.action = null;\n\n    // Interceptor instance to be passed to each of the intercept handlers\n    this._interceptor = new Interceptor();\n\n    // Lookup the associated route for this request\n    this[ROUTE] = polly.server.lookup(this.method, this.url);\n\n    // Filter all matched route handlers by this request\n    this[ROUTE].applyFiltersWithArgs(this);\n\n    // Handle config overrides defined by the route\n    this.configure(this[ROUTE].config());\n\n    // Handle recording name override defined by the route\n    const recordingName = this[ROUTE].recordingName();\n\n    if (recordingName) {\n      this.overrideRecordingName(recordingName);\n    }\n  }\n\n  get url() {\n    // Use .toString() to force a rebuild of the url. This guarantees that\n    // Any changes to the query object get propagated.\n    return this[PARSED_URL].toString();\n  }\n\n  set url(value) {\n    // Make sure to coerce the value into a string as the passed value could be\n    // a WHATWG's URL object.\n    this[PARSED_URL] = parseUrl(`${value}`, true);\n  }\n\n  get absoluteUrl() {\n    const { url } = this;\n\n    return isAbsoluteUrl(url) ? url : new URL(url).href;\n  }\n\n  get protocol() {\n    return this[PARSED_URL].protocol;\n  }\n\n  get hostname() {\n    return this[PARSED_URL].hostname;\n  }\n\n  get port() {\n    return this[PARSED_URL].port;\n  }\n\n  get origin() {\n    return this[PARSED_URL].origin;\n  }\n\n  get pathname() {\n    return this[PARSED_URL].pathname;\n  }\n\n  get query() {\n    return this[PARSED_URL].query;\n  }\n\n  set query(value) {\n    this[PARSED_URL].set('query', value);\n  }\n\n  get hash() {\n    return this[PARSED_URL].hash;\n  }\n\n  set hash(value) {\n    this[PARSED_URL].set('hash', value);\n  }\n\n  get shouldPassthrough() {\n    return this[ROUTE].shouldPassthrough();\n  }\n\n  get shouldIntercept() {\n    return this[ROUTE].shouldIntercept();\n  }\n\n  get log() {\n    if (this.id) {\n      const log = logLevel.getLogger(\n        `@pollyjs/core:${this.recordingName}:${this.id}`\n      );\n\n      log.setLevel(this.config.logLevel);\n\n      return log;\n    } else {\n      return this[POLLY].logger.log;\n    }\n  }\n\n  on(eventName, listener) {\n    this[EVENT_EMITTER].on(eventName, listener);\n\n    return this;\n  }\n\n  once(eventName, listener) {\n    this[EVENT_EMITTER].once(eventName, listener);\n\n    return this;\n  }\n\n  off(eventName, listener) {\n    this[EVENT_EMITTER].off(eventName, listener);\n\n    return this;\n  }\n\n  async init() {\n    // Trigger the `request` event\n    await this._emit('request');\n\n    // Setup the response\n    this.response = new PollyResponse();\n    this.didRespond = false;\n\n    // Setup this request's identifiers, id, and order\n    await this._identify();\n\n    // Timestamp the request\n    this.timestamp = timestamp();\n  }\n\n  async respond(response) {\n    const { statusCode, headers, body, encoding } = response || {};\n\n    assert(\n      'Cannot respond to a request that already has a response.',\n      !this.didRespond\n    );\n\n    if (this.aborted) {\n      return;\n    }\n\n    // Timestamp the response\n    this.response.timestamp = timestamp();\n\n    // Set the status code\n    this.response.status(statusCode);\n\n    // Se the headers\n    this.response.setHeaders(headers);\n\n    // Set the body without modifying any headers (instead of using .send())\n    this.response.body = body;\n\n    this.response.encoding = encoding;\n\n    // Trigger the `beforeResponse` event\n    await this._emit('beforeResponse', this.response);\n\n    // End the response so it can no longer be modified\n    this.response.end();\n\n    this.responseTime =\n      new Date(this.response.timestamp).getTime() -\n      new Date(this.timestamp).getTime();\n\n    this.didRespond = true;\n\n    this.end();\n\n    // Trigger the `response` event\n    await this._emit('response', this.response);\n  }\n\n  abort() {\n    this.aborted = true;\n  }\n\n  overrideRecordingName(recordingName) {\n    validateRecordingName(recordingName);\n    this.recordingName = recordingName;\n    this.recordingId = guidForRecording(recordingName);\n  }\n\n  configure(config) {\n    validateRequestConfig(config);\n    this.config = mergeConfigs(this[POLLY].config, this.config || {}, config);\n  }\n\n  _intercept() {\n    return this[ROUTE].intercept(this, this.response, ...arguments);\n  }\n\n  _emit(eventName, ...args) {\n    return this[ROUTE].emit(eventName, this, ...args);\n  }\n\n  async _identify() {\n    const polly = this[POLLY];\n    const { _requests: requests } = polly;\n    const { matchRequestsBy } = this.config;\n\n    this.identifiers = {};\n\n    // Iterate through each normalizer\n    keys(NormalizeRequest).forEach((key) => {\n      if (this[key] && matchRequestsBy[key]) {\n        this.identifiers[key] = NormalizeRequest[key](\n          this[key],\n          matchRequestsBy[key],\n          this\n        );\n      }\n    });\n\n    // Emit the `identify` event which adapters can use to serialize the request body\n    await this[EVENT_EMITTER].emit('identify', this);\n\n    // Freeze the identifiers so they can no longer be modified\n    freeze(this.identifiers);\n\n    // Guid is a string representation of the identifiers\n    this.id = md5(stringify(this.identifiers));\n\n    // Order is calculated on other requests with the same id and recording id\n    // Only requests before this current one are taken into account.\n    this.order =\n      matchRequestsBy.order && !this.shouldPassthrough && !this.shouldIntercept\n        ? requests\n            .slice(0, requests.indexOf(this))\n            .filter(\n              (r) => r.id === this.id && r.recordingId === this.recordingId\n            ).length\n        : 0;\n\n    this.log.debug('Request Identified:', {\n      id: this.id,\n      order: this.order,\n      identifiers: this.identifiers,\n      request: this\n    });\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/-private/response.js",
    "content": "import { assert, HTTP_STATUS_CODES } from '@pollyjs/utils';\n\nimport HTTPBase from './http-base';\n\nconst DEFAULT_STATUS_CODE = 200;\n\nexport default class PollyResponse extends HTTPBase {\n  constructor(statusCode, headers, body, encoding) {\n    super();\n    this.status(statusCode || DEFAULT_STATUS_CODE);\n    this.setHeaders(headers);\n    this.body = body;\n    this.encoding = encoding;\n  }\n\n  get ok() {\n    return this.statusCode && this.statusCode >= 200 && this.statusCode < 300;\n  }\n\n  get statusText() {\n    return (\n      HTTP_STATUS_CODES[this.statusCode] ||\n      HTTP_STATUS_CODES[DEFAULT_STATUS_CODE]\n    );\n  }\n\n  status(statusCode) {\n    const status = parseInt(statusCode, 10);\n\n    assert(\n      `[Response] Invalid status code: ${status}`,\n      status >= 100 && status < 600\n    );\n\n    this.statusCode = status;\n\n    return this;\n  }\n\n  sendStatus(status) {\n    this.status(status);\n    this.type('text/plain');\n\n    return this.send(this.statusText);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/defaults/config.js",
    "content": "import { MODES, EXPIRY_STRATEGIES } from '@pollyjs/utils';\nimport logLevel from 'loglevel';\n\nimport Timing from '../utils/timing';\n\nexport default {\n  mode: MODES.REPLAY,\n\n  adapters: [],\n  adapterOptions: {},\n\n  persister: null,\n  persisterOptions: {\n    keepUnusedRequests: false,\n    disableSortingHarEntries: false\n  },\n\n  logLevel: logLevel.levels.WARN,\n  flushRequestsOnStop: false,\n\n  recordIfMissing: true,\n  recordFailedRequests: false,\n\n  expiresIn: null,\n  expiryStrategy: EXPIRY_STRATEGIES.WARN,\n  timing: Timing.fixed(0),\n\n  matchRequestsBy: {\n    method: true,\n    headers: true,\n    body: true,\n    order: true,\n\n    url: {\n      protocol: true,\n      username: true,\n      password: true,\n      hostname: true,\n      port: true,\n      pathname: true,\n      query: true,\n      hash: false\n    }\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/core/src/index.js",
    "content": "export { default as Polly } from './polly';\nexport { default as Timing } from './utils/timing';\n\nexport { default as setupQunit } from './test-helpers/qunit';\nexport { default as setupMocha } from './test-helpers/mocha';\n"
  },
  {
    "path": "packages/@pollyjs/core/src/polly.js",
    "content": "import { MODES, assert } from '@pollyjs/utils';\n\nimport { version } from '../package.json';\n\nimport Logger from './-private/logger';\nimport { Container } from './-private/container';\nimport DefaultConfig from './defaults/config';\nimport PollyRequest from './-private/request';\nimport guidForRecording from './utils/guid-for-recording';\nimport mergeConfigs from './utils/merge-configs';\nimport EventEmitter from './-private/event-emitter';\nimport Server from './server';\nimport { validateRecordingName } from './utils/validators';\n\nconst RECORDING_NAME = Symbol();\nconst RECORDING_ID = Symbol();\nconst PAUSED_ADAPTERS = Symbol();\n\nconst FACTORY_REGISTRATION = new WeakMap();\nconst EVENT_EMITTER = new EventEmitter({\n  eventNames: ['register', 'create', 'stop']\n});\n\n/**\n * @export\n * @class Polly\n */\nexport default class Polly {\n  constructor(recordingName, config) {\n    this.recordingName = recordingName;\n    this.server = new Server();\n    this.config = {};\n    this.container = new Container();\n\n    EVENT_EMITTER.emitSync('register', this.container);\n\n    /* running adapter instances */\n    this.adapters = new Map();\n\n    /* running persister instance */\n    this.persister = null;\n\n    /* requests over the lifetime of the polly instance */\n    this._requests = [];\n\n    EVENT_EMITTER.emitSync('create', this);\n    this.configure(config);\n  }\n\n  /**\n   * Package version.\n   *\n   * @readonly\n   * @public\n   * @memberof Polly\n   */\n  static get VERSION() {\n    return version;\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  get recordingName() {\n    return this[RECORDING_NAME];\n  }\n\n  set recordingName(name) {\n    validateRecordingName(name);\n\n    this[RECORDING_NAME] = name;\n    this[RECORDING_ID] = guidForRecording(name);\n  }\n\n  /**\n   * @readonly\n   * @public\n   * @memberof Polly\n   */\n  get recordingId() {\n    return this[RECORDING_ID];\n  }\n\n  get mode() {\n    return this.config.mode;\n  }\n\n  set mode(mode) {\n    const possibleModes = Object.values(MODES);\n\n    assert(\n      `Invalid mode provided: \"${mode}\". Possible modes: ${possibleModes.join(\n        ', '\n      )}.`,\n      possibleModes.includes(mode)\n    );\n\n    this.config.mode = mode;\n  }\n\n  static on(eventName, listener) {\n    EVENT_EMITTER.on(eventName, listener);\n\n    return this;\n  }\n\n  static once(eventName, listener) {\n    EVENT_EMITTER.once(eventName, listener);\n\n    return this;\n  }\n\n  static off(eventName, listener) {\n    EVENT_EMITTER.off(eventName, listener);\n\n    return this;\n  }\n\n  static register(Factory) {\n    if (!FACTORY_REGISTRATION.has(Factory)) {\n      FACTORY_REGISTRATION.set(Factory, (container) =>\n        container.register(Factory)\n      );\n    }\n\n    this.on('register', FACTORY_REGISTRATION.get(Factory));\n\n    return this;\n  }\n\n  static unregister(Factory) {\n    if (FACTORY_REGISTRATION.has(Factory)) {\n      this.off('register', FACTORY_REGISTRATION.get(Factory));\n    }\n\n    return this;\n  }\n\n  /**\n   * @param {Object} [config={}]\n   * @public\n   * @memberof Polly\n   */\n  configure(config = {}) {\n    const { container } = this;\n\n    assert(\n      'Cannot call `configure` once requests have been handled.',\n      this._requests.length === 0\n    );\n    assert(\n      'Cannot call `configure` on an instance of Polly that is not running.',\n      this.mode !== MODES.STOPPED\n    );\n\n    // Disconnect from all current adapters before updating the config\n    this.disconnect();\n\n    if (this.logger) {\n      this.logger.disconnect();\n    }\n\n    // Update the config\n    this.config = mergeConfigs(DefaultConfig, this.config, config);\n\n    // Create a new logger\n    this.logger = new Logger(this);\n    this.logger.connect();\n\n    // Register and connect to all specified adapters\n    this.config.adapters.forEach((adapter) => this.connectTo(adapter));\n\n    /* Handle Persister */\n    let { persister } = this.config;\n\n    if (persister) {\n      if (typeof persister === 'function') {\n        container.register(persister);\n        persister = persister.id;\n      }\n\n      assert(\n        `Persister matching the name \\`${persister}\\` was not registered.`,\n        container.has(`persister:${persister}`)\n      );\n\n      this.persister = new (container.lookup(`persister:${persister}`))(this);\n    }\n\n    this.logger.log.debug('Polly instance configured.', {\n      config: this.config\n    });\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  record() {\n    this.mode = MODES.RECORD;\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  replay() {\n    this.mode = MODES.REPLAY;\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  passthrough() {\n    this.mode = MODES.PASSTHROUGH;\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  pause() {\n    this[PAUSED_ADAPTERS] = [...this.adapters.keys()];\n    this.disconnect();\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  play() {\n    if (this[PAUSED_ADAPTERS]) {\n      this[PAUSED_ADAPTERS].forEach((adapterId) => this.connectTo(adapterId));\n      delete this[PAUSED_ADAPTERS];\n    }\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  async stop() {\n    if (this.mode !== MODES.STOPPED) {\n      if (this.config.flushRequestsOnStop) {\n        await this.flush();\n      }\n\n      this.disconnect();\n\n      await (this.persister && this.persister.persist());\n      this.mode = MODES.STOPPED;\n\n      await EVENT_EMITTER.emit('stop', this);\n\n      this.logger.log.debug('Polly instance stopped.', {\n        recordingName: this.recordingName\n      });\n      this.logger.disconnect();\n    }\n  }\n\n  async flush() {\n    const NOOP = () => {};\n\n    await Promise.all(\n      // The NOOP is there to handle both a resolved and rejected promise\n      // to ensure the promise resolves regardless of the outcome.\n      this._requests.map((r) => Promise.resolve(r.promise).then(NOOP, NOOP))\n    );\n  }\n\n  /**\n   * @param {String|Function} idOrFactory\n   * @public\n   * @memberof Polly\n   */\n  connectTo(idOrAdapter) {\n    const { container, adapters } = this;\n    let adapterId = idOrAdapter;\n\n    if (typeof idOrAdapter === 'function') {\n      container.register(idOrAdapter);\n      adapterId = idOrAdapter.id;\n    }\n\n    assert(\n      `Adapter matching the name \\`${adapterId}\\` was not registered.`,\n      container.has(`adapter:${adapterId}`)\n    );\n\n    this.disconnectFrom(adapterId);\n\n    const adapter = new (container.lookup(`adapter:${adapterId}`))(this);\n\n    adapter.connect();\n    adapters.set(adapterId, adapter);\n  }\n\n  /**\n   * @param {String|Function} idOrAdapter\n   * @public\n   * @memberof Polly\n   */\n  disconnectFrom(idOrAdapter) {\n    const { adapters } = this;\n    let adapterId = idOrAdapter;\n\n    if (typeof idOrAdapter === 'function') {\n      adapterId = idOrAdapter.id;\n    }\n\n    if (adapters.has(adapterId)) {\n      adapters.get(adapterId).disconnect();\n      adapters.delete(adapterId);\n    }\n  }\n\n  /**\n   * @public\n   * @memberof Polly\n   */\n  disconnect() {\n    for (const adapterId of this.adapters.keys()) {\n      this.disconnectFrom(adapterId);\n    }\n  }\n\n  /**\n   * @param {Object} [request={}]\n   * @returns {PollyRequest}\n   * @private\n   * @memberof Polly\n   */\n  registerRequest(request = {}) {\n    const pollyRequest = new PollyRequest(this, request);\n\n    this._requests.push(pollyRequest);\n\n    return pollyRequest;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/server/handler.js",
    "content": "import { assert } from '@pollyjs/utils';\n\nimport EventEmitter from '../-private/event-emitter';\nimport cancelFnAfterNTimes from '../utils/cancel-fn-after-n-times';\nimport {\n  validateTimesOption,\n  validateRecordingName,\n  validateRequestConfig\n} from '../utils/validators';\n\nexport default class Handler extends Map {\n  constructor() {\n    super();\n\n    this.set('config', {});\n    this.set('defaultOptions', {});\n    this.set('filters', new Set());\n\n    this._eventEmitter = new EventEmitter({\n      eventNames: [\n        'error',\n        'abort',\n        'request',\n        'beforeReplay',\n        'beforePersist',\n        'beforeResponse',\n        'response'\n      ]\n    });\n  }\n\n  on(eventName, listener, options = {}) {\n    this._eventEmitter.on(eventName, listener, {\n      ...this.get('defaultOptions'),\n      ...options\n    });\n\n    return this;\n  }\n\n  once(eventName, listener) {\n    this._eventEmitter.once(eventName, listener);\n\n    return this;\n  }\n\n  off(eventName, listener) {\n    this._eventEmitter.off(eventName, listener);\n\n    return this;\n  }\n\n  passthrough(value = true) {\n    this.set('passthrough', Boolean(value));\n\n    if (this.get('passthrough')) {\n      this.delete('intercept');\n    }\n\n    return this;\n  }\n\n  intercept(fn, options = {}) {\n    assert(\n      `Invalid intercept handler provided. Expected function, received: \"${typeof fn}\".`,\n      typeof fn === 'function'\n    );\n\n    options = { ...this.get('defaultOptions'), ...options };\n\n    if ('times' in options) {\n      validateTimesOption(options.times);\n      fn = cancelFnAfterNTimes(fn, options.times, () =>\n        this.delete('intercept')\n      );\n    }\n\n    this.set('intercept', fn);\n    this.passthrough(false);\n\n    return this;\n  }\n\n  recordingName(recordingName) {\n    if (recordingName) {\n      validateRecordingName(recordingName);\n    }\n\n    this.set('recordingName', recordingName);\n\n    return this;\n  }\n\n  configure(config) {\n    validateRequestConfig(config);\n    this.set('config', config);\n\n    return this;\n  }\n\n  filter(fn) {\n    assert(\n      `Invalid filter callback provided. Expected function, received: \"${typeof fn}\".`,\n      typeof fn === 'function'\n    );\n\n    this.get('filters').add(fn);\n\n    return this;\n  }\n\n  times(n) {\n    if (!n && typeof n !== 'number') {\n      delete this.get('defaultOptions').times;\n    } else {\n      validateTimesOption(n);\n      this.get('defaultOptions').times = n;\n    }\n\n    return this;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/server/index.js",
    "content": "import RouteRecognizer from 'route-recognizer';\nimport castArray from 'lodash-es/castArray';\nimport { HTTP_METHODS, URL, assert, timeout, buildUrl } from '@pollyjs/utils';\n\nimport Route from './route';\nimport Handler from './handler';\nimport Middleware from './middleware';\n\nconst HOST = Symbol();\nconst NAMESPACES = Symbol();\nconst REGISTRY = Symbol();\nconst MIDDLEWARE = Symbol();\nconst HANDLERS = Symbol();\n\nconst CHARS = {\n  SLASH: '/',\n  STAR: '*',\n  COLON: ':'\n};\n\nconst { keys } = Object;\n\nfunction parseUrl(url) {\n  const parsedUrl = new URL(url);\n  /*\n    Use the full origin (http://hostname:port) if the host exists. If there\n    is no host, URL.origin returns \"null\" (null as a string) so set host to '/'\n  */\n  const host = parsedUrl.host ? parsedUrl.origin : CHARS.SLASH;\n  const path = parsedUrl.pathname || CHARS.SLASH;\n\n  return { host, path };\n}\n\nexport default class Server {\n  constructor() {\n    this[HOST] = '';\n    this[REGISTRY] = {};\n    this[NAMESPACES] = [];\n    this[MIDDLEWARE] = [];\n  }\n\n  host(path, callback) {\n    const host = this[HOST];\n\n    assert(`[Server] A host cannot be specified within another host.`, !host);\n\n    this[HOST] = path;\n    callback(this);\n    this[HOST] = host;\n  }\n\n  namespace(path, callback) {\n    const namespaces = this[NAMESPACES];\n\n    this[NAMESPACES] = [...namespaces, path];\n    callback(this);\n    this[NAMESPACES] = namespaces;\n  }\n\n  timeout() {\n    return timeout(...arguments);\n  }\n\n  get() {\n    return this._register('GET', ...arguments);\n  }\n\n  put() {\n    return this._register('PUT', ...arguments);\n  }\n\n  post() {\n    return this._register('POST', ...arguments);\n  }\n\n  delete() {\n    return this._register('DELETE', ...arguments);\n  }\n\n  patch() {\n    return this._register('PATCH', ...arguments);\n  }\n\n  merge() {\n    return this._register('MERGE', ...arguments);\n  }\n\n  head() {\n    return this._register('HEAD', ...arguments);\n  }\n\n  options() {\n    return this._register('OPTIONS', ...arguments);\n  }\n\n  any() {\n    return this._registerMiddleware(...arguments);\n  }\n\n  lookup(method, url) {\n    return new Route(this._recognize(method, url), this._lookupMiddleware(url));\n  }\n\n  _lookupMiddleware(url) {\n    const { host, path } = parseUrl(url);\n\n    return this[MIDDLEWARE].map((m) => m.match(host, path)).filter(Boolean);\n  }\n\n  _register(method, routes) {\n    const handler = new Handler();\n\n    castArray(routes).forEach((route) => {\n      const { host, path } = parseUrl(this._buildUrl(route));\n      const registry = this._registryForHost(host);\n      const name = this._nameForPath(path);\n      const router = registry[method.toUpperCase()];\n\n      if (router[HANDLERS].has(name)) {\n        router[HANDLERS].get(name).push(handler);\n      } else {\n        router[HANDLERS].set(name, [handler]);\n        router.add([{ path, handler: router[HANDLERS].get(name) }]);\n      }\n    });\n\n    return handler;\n  }\n\n  _registerMiddleware(routes) {\n    const handler = new Handler();\n    const pathsByHost = {};\n\n    castArray(routes).forEach((route) => {\n      /*\n        If the route is a '*' or '' and there is no host or namespace\n        specified, treat the middleware as global so it will match all routes.\n      */\n      if (\n        (!route || route === CHARS.STAR) &&\n        !this[HOST] &&\n        this[NAMESPACES].length === 0\n      ) {\n        this[MIDDLEWARE].push(new Middleware({ global: true, handler }));\n      } else {\n        const { host, path } = parseUrl(this._buildUrl(route));\n\n        pathsByHost[host] = pathsByHost[host] || [];\n        pathsByHost[host].push(path);\n      }\n    });\n\n    keys(pathsByHost).forEach((host) => {\n      this[MIDDLEWARE].push(\n        new Middleware({ host, paths: pathsByHost[host], handler })\n      );\n    });\n\n    return handler;\n  }\n\n  _recognize(method, url) {\n    const { host, path } = parseUrl(url);\n    const registry = this._registryForHost(host);\n\n    return registry[method.toUpperCase()].recognize(path);\n  }\n\n  _buildUrl(path) {\n    return buildUrl(this[HOST], ...this[NAMESPACES], path);\n  }\n\n  /**\n   * Converts a url path into a name used to combine route handlers by\n   * normalizing dynamic and star segments\n   * @param {String} path\n   * @returns {String}\n   */\n  _nameForPath(path = '') {\n    const name = path\n      .split(CHARS.SLASH)\n      .map((segment) => {\n        switch (segment.charAt(0)) {\n          // If this is a dynamic segment (e.g. :id), then just return `:`\n          // since /path/:id is the same as /path/:uuid\n          case CHARS.COLON:\n            return CHARS.COLON;\n          // If this is a star segment (e.g. *path), then just return `*`\n          // since /path/*path is the same as /path/*all\n          case CHARS.STAR:\n            return CHARS.STAR;\n          default:\n            return segment;\n        }\n      })\n      .join(CHARS.SLASH);\n\n    // Remove trailing slash, if we result with an empty string, return a slash\n    return name.replace(/\\/$/, '') || CHARS.SLASH;\n  }\n\n  _registryForHost(host) {\n    if (!this[REGISTRY][host]) {\n      this[REGISTRY][host] = HTTP_METHODS.reduce((acc, method) => {\n        acc[method] = new RouteRecognizer();\n        acc[method][HANDLERS] = new Map();\n\n        return acc;\n      }, {});\n    }\n\n    return this[REGISTRY][host];\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/server/middleware.js",
    "content": "import RouteRecognizer from 'route-recognizer';\n\nimport Route from './route';\n\nconst GLOBAL = '__GLOBAL__';\n\nexport default class Middleware {\n  constructor({ host, paths, global, handler }) {\n    this.global = Boolean(global);\n    this.handler = handler;\n    this.host = host;\n    this.paths = this.global ? [GLOBAL] : paths;\n    this._routeRecognizer = new RouteRecognizer();\n\n    this.paths.forEach((path) =>\n      this._routeRecognizer.add([{ path, handler: [handler] }])\n    );\n  }\n\n  match(host, path) {\n    if (this.global) {\n      return new Route(this._routeRecognizer.recognize(GLOBAL));\n    }\n\n    if (this.host === host) {\n      const recognizeResult = this._routeRecognizer.recognize(path);\n\n      return recognizeResult && new Route(recognizeResult);\n    }\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/server/route.js",
    "content": "import mergeConfigs from '../utils/merge-configs';\n\nconst HANDLERS = Symbol();\n\nfunction requestWithParams(req, { params }) {\n  return new Proxy(req, {\n    set(source, prop, value) {\n      /* NOTE: IE's `Reflect.set` swallows the read-only assignment error */\n      /* see: https://codepen.io/jasonmit/pen/LrmLaz */\n      source[prop] = value;\n\n      return true;\n    },\n    get(source, prop) {\n      if (prop === 'params') {\n        // Set the request's params to given route's matched params\n        return { ...params };\n      }\n\n      return Reflect.get(source, prop);\n    }\n  });\n}\n\nexport default class Route {\n  /**\n   *\n   * @param {RecognizeResults} recognizeResults\n   * @param {Array<Route>} middleware\n   */\n  constructor(recognizeResults, middleware) {\n    const result = recognizeResults && recognizeResults[0];\n\n    this.params = {};\n    this.queryParams = {};\n    this.handlers = [];\n    this.middleware = middleware || [];\n\n    if (result) {\n      this.handlers = result.handler;\n      this.params = { ...result.params };\n      this.queryParams = recognizeResults.queryParams;\n    }\n\n    this[HANDLERS] = this._orderedHandlers();\n  }\n\n  shouldPassthrough() {\n    return Boolean(this._valueFor('passthrough'));\n  }\n\n  shouldIntercept() {\n    return Boolean(this._valueFor('intercept'));\n  }\n\n  recordingName() {\n    return this._valueFor('recordingName') || null;\n  }\n\n  config() {\n    return mergeConfigs(\n      ...this[HANDLERS].map(({ handler }) => handler.get('config'))\n    );\n  }\n\n  applyFiltersWithArgs(req, ...args) {\n    this[HANDLERS] = this[HANDLERS].filter(({ route, handler }) =>\n      [...handler.get('filters')].every((fn) =>\n        fn(requestWithParams(req, route), ...args)\n      )\n    );\n  }\n\n  /**\n   * Invokes the intercept handlers defined on the routes + middleware.\n   * @param {PollyRequest} req\n   * @param {PollyResponse} res\n   * @param {Interceptor} interceptor\n   */\n  async intercept(req, res, interceptor) {\n    for (const { route, handler } of this[HANDLERS]) {\n      if (!interceptor.shouldIntercept || interceptor.shouldStopPropagating) {\n        return;\n      }\n\n      if (handler.has('intercept')) {\n        await handler.get('intercept')(\n          requestWithParams(req, route),\n          res,\n          interceptor\n        );\n      }\n    }\n  }\n\n  /**\n   * Emit an event registered on the handler + all middleware handler events\n   * @param {String} eventName\n   * @param {PollyRequest} req\n   * @param {...args} ...args\n   */\n  async emit(eventName, req, ...args) {\n    for (const { route, handler } of this[HANDLERS]) {\n      const shouldContinue = await handler._eventEmitter.emit(\n        eventName,\n        requestWithParams(req, route),\n        ...args\n      );\n\n      if (!shouldContinue) {\n        return;\n      }\n    }\n  }\n\n  _orderedHandlers() {\n    return [...this.middleware, this].reduce((handlers, route) => {\n      handlers.push(...route.handlers.map((handler) => ({ route, handler })));\n\n      return handlers;\n    }, []);\n  }\n\n  _valueFor(key) {\n    let value;\n\n    for (const { handler } of this[HANDLERS]) {\n      if (handler.has(key)) {\n        value = handler.get(key);\n      }\n    }\n\n    return value;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/test-helpers/lib.js",
    "content": "import { PollyError } from '@pollyjs/utils';\n\nimport Polly from '../polly';\n\nconst { defineProperty } = Object;\n\nexport function beforeEach(context, recordingName, defaults) {\n  defineProperty(context, 'polly', {\n    writable: true,\n    enumerable: true,\n    configurable: true,\n    value: new Polly(recordingName, defaults)\n  });\n}\n\nexport async function afterEach(context, framework) {\n  await context.polly.stop();\n\n  defineProperty(context, 'polly', {\n    enumerable: true,\n    configurable: true,\n    get() {\n      throw new PollyError(\n        `You are trying to access an instance of Polly that is no longer available.\\n` +\n          `See: https://netflix.github.io/pollyjs/#/test-frameworks/${framework}?id=test-hook-ordering`\n      );\n    }\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/test-helpers/mocha.js",
    "content": "import { afterEach, beforeEach } from './lib';\n\nfunction generateRecordingName(context) {\n  const { currentTest } = context;\n  const parts = [currentTest.title];\n  let parent = currentTest.parent;\n\n  while (parent && parent.title) {\n    parts.push(parent.title);\n    parent = parent.parent;\n  }\n\n  return parts.reverse().join('/');\n}\n\nexport default function setupMocha(defaults = {}, ctx = global) {\n  setupMocha.beforeEach(defaults, ctx);\n  setupMocha.afterEach(ctx);\n}\n\nsetupMocha.beforeEach = function setupMochaBeforeEach(defaults, ctx = global) {\n  ctx.beforeEach(function () {\n    return beforeEach(this, generateRecordingName(this), defaults);\n  });\n};\n\nsetupMocha.afterEach = function setupMochaAfterEach(ctx = global) {\n  ctx.afterEach(function () {\n    return afterEach(this, 'mocha');\n  });\n};\n"
  },
  {
    "path": "packages/@pollyjs/core/src/test-helpers/qunit.js",
    "content": "import { afterEach, beforeEach } from './lib';\n\nfunction generateRecordingName(assert) {\n  return assert.test.testReport.fullName.join('/');\n}\n\nexport default function setupQunit(hooks, defaults = {}) {\n  setupQunit.beforeEach(hooks, defaults);\n  setupQunit.afterEach(hooks);\n}\n\nsetupQunit.beforeEach = function setupQunitBeforeEach(hooks, defaults = {}) {\n  hooks.beforeEach(function () {\n    return beforeEach(this, generateRecordingName(...arguments), defaults);\n  });\n};\n\nsetupQunit.afterEach = function setupQunitAfterEach(hooks) {\n  hooks.afterEach(function () {\n    return afterEach(this, 'qunit');\n  });\n};\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/cancel-fn-after-n-times.js",
    "content": "/**\n * Create a function that will execute the given fn and call the cancel\n * callback after being called n times.\n *\n * @export\n * @param {Function} fn\n * @param {Number} nTimes\n * @param {Function} cancel\n * @returns\n */\nexport default function cancelFnAfterNTimes(fn, nTimes, cancel) {\n  let callCount = 0;\n\n  return function (...args) {\n    if (++callCount >= nTimes) {\n      cancel();\n    }\n\n    return fn(...args);\n  };\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/deferred-promise.js",
    "content": "/**\n * Create a deferred promise with `resolve` and `reject` methods.\n */\nexport default function defer() {\n  let _resolve;\n  let _reject;\n\n  const promise = new Promise((resolve, reject) => {\n    _resolve = resolve;\n    _reject = reject;\n  });\n\n  // Prevent unhandled rejection warnings\n  promise.catch(() => {});\n\n  promise.resolve = _resolve;\n  promise.reject = _reject;\n\n  return promise;\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/guid-for-recording.js",
    "content": "import fnv1a from '@sindresorhus/fnv1a';\nimport slugify from 'slugify';\n\nfunction sanitize(str) {\n  // Strip non-alphanumeric chars (\\W is the equivalent of [^0-9a-zA-Z_])\n  return str.replace(/\\W/g, '-');\n}\n\nfunction guidFor(str) {\n  const hash = fnv1a(str).toString();\n  let slug = slugify(sanitize(str));\n\n  // Max the slug at 100 char\n  slug = slug.substring(0, 100 - hash.length - 1);\n\n  return `${slug}_${hash}`;\n}\n\nexport default function guidForRecording(recording) {\n  return (recording || '').split('/').map(guidFor).join('/');\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/http-headers.js",
    "content": "import isObjectLike from 'lodash-es/isObjectLike';\n\nconst { keys } = Object;\n\nconst HANDLER = {\n  get(obj, prop) {\n    // `prop` can be a Symbol so only lower-case string based props.\n    return obj[typeof prop === 'string' ? prop.toLowerCase() : prop];\n  },\n\n  set(obj, prop, value) {\n    if (typeof prop !== 'string') {\n      return false;\n    }\n\n    if (value === null || typeof value === 'undefined') {\n      delete obj[prop.toLowerCase()];\n    } else {\n      obj[prop.toLowerCase()] = value;\n    }\n\n    return true;\n  },\n\n  deleteProperty(obj, prop) {\n    if (typeof prop !== 'string') {\n      return false;\n    }\n\n    delete obj[prop.toLowerCase()];\n\n    return true;\n  }\n};\n\nexport default function HTTPHeaders(headers) {\n  const proxy = new Proxy({}, HANDLER);\n\n  if (isObjectLike(headers)) {\n    keys(headers).forEach((h) => (proxy[h] = headers[h]));\n  }\n\n  return proxy;\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/merge-configs.js",
    "content": "import mergeWith from 'lodash-es/mergeWith';\n\nfunction customizer(objValue, srcValue, key) {\n  // Arrays and `context` options should just replace the existing value\n  // and not be deep merged.\n  if (Array.isArray(objValue) || ['context'].includes(key)) {\n    return srcValue;\n  }\n}\n\nexport default function mergeConfigs(...configs) {\n  return mergeWith({}, ...configs, customizer);\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/normalize-request.js",
    "content": "import isObjectLike from 'lodash-es/isObjectLike';\nimport stringify from 'fast-json-stable-stringify';\n\nimport parseUrl from './parse-url';\nimport HTTPHeaders from './http-headers';\n\nconst { keys } = Object;\nconst { isArray } = Array;\nconst { parse } = JSON;\n\nfunction isFunction(fn) {\n  return typeof fn === 'function';\n}\n\nexport function method(method, config, req) {\n  return isFunction(config) ? config(method, req) : method.toUpperCase();\n}\n\nexport function url(url, config, req) {\n  let parsedUrl = parseUrl(url, true);\n\n  if (isFunction(config)) {\n    parsedUrl = parseUrl(config(url, req), true);\n  } else {\n    // Remove any url properties that have been disabled via the config\n    keys(config || {}).forEach((key) => {\n      if (isFunction(config[key])) {\n        parsedUrl.set(key, config[key](parsedUrl[key], req));\n      } else if (!config[key]) {\n        parsedUrl.set(key, '');\n      }\n    });\n  }\n\n  // Sort Query Params\n  if (isObjectLike(parsedUrl.query)) {\n    parsedUrl.set('query', parse(stringify(parsedUrl.query)));\n  }\n\n  return parsedUrl.href;\n}\n\nexport function headers(headers, config, req) {\n  const normalizedHeaders = new HTTPHeaders(headers);\n\n  if (isFunction(config)) {\n    return config(normalizedHeaders, req);\n  }\n\n  if (isObjectLike(config) && isArray(config.exclude)) {\n    config.exclude.forEach((header) => delete normalizedHeaders[header]);\n  }\n\n  return normalizedHeaders;\n}\n\nexport function body(body, config, req) {\n  return isFunction(config) ? config(body, req) : body;\n}\n\nexport default {\n  headers,\n  method,\n  body,\n  url\n};\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/parse-url.js",
    "content": "import isAbsoluteUrl from 'is-absolute-url';\nimport { URL } from '@pollyjs/utils';\n\nimport removeHostFromUrl from './remove-host-from-url';\n\n/**\n * Creates an exact representation of the passed url string with url-parse.\n *\n * @param {String} url\n * @param {...args} args Arguments to pass through to the URL constructor\n * @returns {URL} A url-parse URL instance\n */\nexport default function parseUrl(url, ...args) {\n  const parsedUrl = new URL(url, ...args);\n\n  if (!isAbsoluteUrl(url)) {\n    if (url.startsWith('//')) {\n      /*\n        If the url is protocol-relative, strip out the protocol\n      */\n      parsedUrl.set('protocol', '');\n    } else {\n      /*\n        If the url is relative, setup the parsed url to reflect just that\n        by removing the host. By default URL sets the host via window.location if\n        it does not exist.\n      */\n      removeHostFromUrl(parsedUrl);\n    }\n  }\n\n  return parsedUrl;\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/remove-host-from-url.js",
    "content": "/**\n * Remove the host, protocol, and slashes from a URL instance.\n *\n * @param {URL} url\n */\nexport default function removeHostFromUrl(url) {\n  url.set('protocol', '');\n  url.set('host', '');\n  url.set('slashes', false);\n\n  return url;\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/timing.js",
    "content": "import { timeout } from '@pollyjs/utils';\n\nexport default {\n  fixed(ms) {\n    return () => timeout(ms);\n  },\n\n  relative(ratio) {\n    return (ms) => timeout(ratio * ms);\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/core/src/utils/validators.js",
    "content": "import isObjectLike from 'lodash-es/isObjectLike';\nimport { assert } from '@pollyjs/utils';\n\nexport function validateRecordingName(name) {\n  assert(\n    `Invalid recording name provided. Expected string, received: \"${typeof name}\".`,\n    typeof name === 'string'\n  );\n\n  assert(\n    `Invalid recording name provided. Received An empty or blank string.`,\n    name.trim().length > 0\n  );\n}\n\nexport function validateRequestConfig(config) {\n  assert(\n    `Invalid config provided. Expected object, received: \"${typeof config}\".`,\n    isObjectLike(config) && !Array.isArray(config)\n  );\n\n  // The following options cannot be overridden on a per request basis\n  [\n    'mode',\n    'adapters',\n    'adapterOptions',\n    'persister',\n    'persisterOptions'\n  ].forEach((key) =>\n    assert(\n      `Invalid configuration option provided. The \"${key}\" option cannot be overridden using the server configuration API.`,\n      !(key in config)\n    )\n  );\n}\n\nexport function validateTimesOption(times) {\n  assert(\n    `Invalid number provided. Expected number, received: \"${typeof times}\".`,\n    typeof times === 'number'\n  );\n\n  assert(\n    `Invalid number provided. The number must be greater than 0, received \"${typeof times}\".`,\n    times > 0\n  );\n}\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/container-test.js",
    "content": "import { PollyError } from '@pollyjs/utils';\n\nimport { Container } from '../../../src/-private/container';\n\nlet container;\n\nclass Factory {\n  static get id() {\n    return 'factory-id';\n  }\n\n  static get type() {\n    return 'factory';\n  }\n}\n\ndescribe('Unit | Container', function () {\n  it('should exist', function () {\n    expect(() => new Container()).to.not.throw();\n    expect(new Container()).to.exist;\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      container = new Container();\n    });\n\n    it('.register()', function () {\n      container.register(Factory);\n      expect(container.has('factory:factory-id')).to.be.true;\n    });\n\n    it('.register() - validation', function () {\n      class NoId extends Factory {\n        static get id() {\n          return undefined;\n        }\n      }\n\n      class NoType extends Factory {\n        static get type() {\n          return undefined;\n        }\n      }\n\n      expect(() => container.register()).to.throw(\n        PollyError,\n        /invalid factory provided/\n      );\n      expect(() => container.register(NoId)).to.throw(\n        PollyError,\n        /Invalid registration id provided/\n      );\n      expect(() => container.register(NoType)).to.throw(\n        PollyError,\n        /Invalid registration type provided/\n      );\n    });\n\n    it('.unregister() - by key', function () {\n      container.register(Factory);\n      expect(container.has('factory:factory-id')).to.be.true;\n\n      container.unregister('factory:factory-id');\n      expect(container.has('factory:factory-id')).to.be.false;\n    });\n\n    it('.unregister() - by factory', function () {\n      container.register(Factory);\n      expect(container.has('factory:factory-id')).to.be.true;\n\n      container.unregister(Factory);\n      expect(container.has('factory:factory-id')).to.be.false;\n    });\n\n    it('.lookup()', function () {\n      container.register(Factory);\n      expect(container.lookup('factory:factory-id')).to.equal(Factory);\n      expect(container.lookup('factory:bar')).to.be.null;\n    });\n\n    it('.has() - by key', function () {\n      container.register(Factory);\n      expect(container.has('factory:factory-id')).to.be.true;\n      expect(container.has('factory:bar')).to.be.false;\n    });\n\n    it('.has() - by factory', function () {\n      class ExtendedFactory extends Factory {\n        static get id() {\n          return 'extended-factory-id';\n        }\n      }\n\n      container.register(Factory);\n      expect(container.has(Factory)).to.be.true;\n      expect(container.has(ExtendedFactory)).to.be.false;\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/event-emitter-test.js",
    "content": "import { PollyError, timeout } from '@pollyjs/utils';\n\nimport EventEmitter from '../../../src/-private/event-emitter';\n\nlet emitter;\n\nfunction assertEventName(methodName) {\n  expect(() => emitter[methodName]()).to.throw(\n    PollyError,\n    /Invalid event name provided. Expected string/\n  );\n  expect(() => emitter[methodName]('invalid')).to.throw(\n    PollyError,\n    /Possible events: a, b/\n  );\n}\n\nfunction assertListener(methodName) {\n  expect(() => emitter[methodName]('a')).to.throw(\n    PollyError,\n    /Invalid listener provided/\n  );\n}\n\ndescribe('Unit | EventEmitter', function () {\n  it('should exist', function () {\n    expect(() => new EventEmitter({ eventNames: ['a'] })).to.not.throw();\n    expect(new EventEmitter({ eventNames: ['a'] })).to.exist;\n  });\n\n  it('should throw without eventNames', function () {\n    expect(() => new EventEmitter()).to.throw(PollyError);\n    expect(() => new EventEmitter({ eventNames: [] })).to.throw(\n      PollyError,\n      /supported events must be provided/\n    );\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      emitter = new EventEmitter({\n        eventNames: ['a', 'b']\n      });\n    });\n\n    it('.eventNames()', function () {\n      const listener = () => {};\n\n      expect(emitter.eventNames()).to.have.lengthOf(0);\n\n      emitter.on('a', listener);\n      emitter.on('b', listener);\n      expect(emitter.eventNames()).to.have.ordered.members(['a', 'b']);\n\n      emitter.off('a', listener);\n      expect(emitter.eventNames()).to.have.ordered.members(['b']);\n    });\n\n    it('.on()', async function () {\n      assertEventName('on');\n      assertListener('on');\n\n      let listenerCalled = 0;\n      const listener = () => listenerCalled++;\n\n      emitter.on('a', listener);\n      emitter.on('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n\n      emitter.on('a', () => {});\n      expect(emitter.listeners('a')).to.have.lengthOf(2);\n\n      await emitter.emit('a');\n      expect(listenerCalled).to.equal(1);\n    });\n\n    it('.on(listener, { times })', async function () {\n      assertEventName('on');\n      assertListener('on');\n\n      let listenerCalled = 0;\n      const listener = () => listenerCalled++;\n\n      expect(() => emitter.on('a', listener, { times: '1' })).to.throw(\n        PollyError,\n        /Invalid number provided/\n      );\n\n      expect(() => emitter.on('a', listener, { times: -1 })).to.throw(\n        PollyError,\n        /The number must be greater than 0/\n      );\n\n      emitter.on('a', listener, { times: 1 });\n      emitter.on('a', listener, { times: 2 });\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n\n      await emitter.emit('a');\n      await emitter.emit('a');\n      await emitter.emit('a');\n\n      expect(listenerCalled).to.equal(2);\n      expect(emitter.listeners('a')).to.have.lengthOf(0);\n    });\n\n    it('.once()', async function () {\n      assertEventName('once');\n      assertListener('once');\n\n      let listenerCalled = 0;\n      const listener = () => listenerCalled++;\n\n      emitter.once('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n\n      await emitter.emit('a');\n      expect(listenerCalled).to.equal(1);\n      expect(emitter.listeners('a')).to.have.lengthOf(0);\n\n      await emitter.emit('a');\n      expect(listenerCalled).to.equal(1);\n\n      emitter.once('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n\n      emitter.off('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(0);\n    });\n\n    it('.off()', async function () {\n      assertEventName('off');\n\n      const listener = () => {};\n\n      emitter.on('a', listener);\n      emitter.on('a', () => {});\n      emitter.on('a', () => {});\n      expect(emitter.listeners('a')).to.have.lengthOf(3);\n\n      emitter.off('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(2);\n\n      emitter.off('a');\n      expect(emitter.listeners('a')).to.have.lengthOf(0);\n\n      emitter.on('a', listener, { times: 3 });\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n\n      emitter.off('a', listener);\n      expect(emitter.listeners('a')).to.have.lengthOf(0);\n    });\n\n    it('.listeners()', async function () {\n      assertEventName('listeners');\n\n      expect(emitter.listeners('a')).to.be.an('array');\n      expect(emitter.listeners('a')).to.deep.equal([]);\n\n      emitter.on('a', () => {});\n      emitter.on('b', () => {});\n      emitter.on('b', () => {});\n      expect(emitter.listeners('a')).to.be.an('array');\n      expect(emitter.listeners('a')).to.have.lengthOf(1);\n      expect(emitter.listeners('b')).to.have.lengthOf(2);\n\n      emitter.off('b');\n      expect(emitter.listeners('b')).to.be.an('array');\n      expect(emitter.listeners('b')).to.have.lengthOf(0);\n    });\n\n    it('.hasListeners()', async function () {\n      assertEventName('hasListeners');\n\n      expect(emitter.hasListeners('a')).to.be.false;\n\n      emitter.on('a', () => {});\n      expect(emitter.hasListeners('a')).to.be.true;\n\n      emitter.off('a');\n      expect(emitter.hasListeners('a')).to.be.false;\n    });\n\n    it('.emit()', async function () {\n      expect(emitter.emit('a')).to.be.a('promise');\n\n      const array = [];\n\n      emitter.on('a', () => array.push(1));\n      emitter.on('a', async () => {\n        await timeout(10);\n        array.push(2);\n      });\n      emitter.on('a', () => array.push(3));\n\n      expect(await emitter.emit('a')).to.be.true;\n      expect(array).to.have.ordered.members([1, 2, 3]);\n    });\n\n    it('.emit() - stopPropagation', async function () {\n      const array = [];\n\n      emitter.on('a', async (e) => {\n        e.stopPropagation();\n        array.push(1);\n      });\n      emitter.on('a', () => array.push(2));\n\n      expect(await emitter.emit('a')).to.be.false;\n      expect(array).to.have.ordered.members([1]);\n    });\n\n    it('.emitParallel()', async function () {\n      expect(emitter.emitParallel('a')).to.be.a('promise');\n\n      const array = [];\n\n      emitter.on('a', () => array.push(1));\n      emitter.on('a', async () => {\n        await timeout(20);\n        array.push(2);\n      });\n      emitter.on('a', async () => {\n        await timeout(10);\n        array.push(3);\n      });\n\n      expect(await emitter.emitParallel('a')).to.be.true;\n      expect(array).to.have.ordered.members([1, 3, 2]);\n    });\n\n    it('.emitParallel() - stopPropagation', async function () {\n      const array = [];\n\n      emitter.on('a', async (e) => {\n        e.stopPropagation();\n        array.push(1);\n      });\n      emitter.on('a', () => array.push(2));\n\n      expect(await emitter.emitParallel('a')).to.be.false;\n      expect(array).to.have.ordered.members([1, 2]);\n    });\n\n    it('.emitSync()', async function () {\n      emitter.once('a', () => Promise.resolve());\n      expect(() => emitter.emitSync('a')).to.throw(\n        PollyError,\n        /Attempted to emit a synchronous event/\n      );\n\n      const array = [];\n\n      emitter.on('a', () => array.push(1));\n      emitter.on('a', () => array.push(2));\n      emitter.on('a', () => array.push(3));\n\n      expect(emitter.emitSync('a')).to.be.true;\n      expect(array).to.have.ordered.members([1, 2, 3]);\n    });\n\n    it('.emitSync() - stopPropagation', async function () {\n      const array = [];\n\n      emitter.on('a', (e) => {\n        e.stopPropagation();\n        array.push(1);\n      });\n      emitter.on('a', () => array.push(2));\n\n      expect(emitter.emitSync('a')).to.be.false;\n      expect(array).to.have.ordered.members([1]);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/event-test.js",
    "content": "import { PollyError } from '@pollyjs/utils';\n\nimport Event from '../../../src/-private/event';\n\nconst EVENT_TYPE = 'foo';\n\ndescribe('Unit | Event', function () {\n  it('should exist', function () {\n    expect(Event).to.be.a('function');\n  });\n\n  it('should throw if no type is specified', function () {\n    expect(() => new Event()).to.throw(PollyError, /Invalid type provided/);\n  });\n\n  it('should have the correct defaults', function () {\n    const event = new Event(EVENT_TYPE);\n\n    expect(event.type).to.equal(EVENT_TYPE);\n    expect(event.shouldStopPropagating).to.be.false;\n  });\n\n  it('should not be able to edit the type', function () {\n    const event = new Event(EVENT_TYPE);\n\n    expect(event.type).to.equal(EVENT_TYPE);\n    expect(() => (event.type = 'bar')).to.throw(Error);\n  });\n\n  it('should be able to attach any other properties', function () {\n    const event = new Event(EVENT_TYPE, { foo: 1, bar: 2 });\n\n    expect(event.foo).to.equal(1);\n    expect(event.bar).to.equal(2);\n  });\n\n  it('.stopPropagation()', function () {\n    const event = new Event(EVENT_TYPE);\n\n    expect(event.shouldStopPropagating).to.be.false;\n    event.stopPropagation();\n    expect(event.shouldStopPropagating).to.be.true;\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/http-base-test.js",
    "content": "import stringify from 'fast-json-stable-stringify';\n\nimport HTTPBase from '../../../src/-private/http-base';\n\nlet base;\n\ndescribe('Unit | HTTPBase', function () {\n  it('should exist', function () {\n    expect(() => new HTTPBase()).to.not.throw();\n    expect(new HTTPBase()).to.exist;\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      base = new HTTPBase();\n    });\n\n    it('.getHeader()', function () {\n      const { headers } = base;\n\n      base.setHeader('One', '1');\n      expect(headers).to.deep.equal({ one: '1' });\n\n      expect(base.getHeader('One')).to.equal('1');\n      expect(base.getHeader('one')).to.equal('1');\n      expect(base.getHeader('Two')).to.be.undefined;\n\n      base.removeHeader('One');\n      expect(base.getHeader('One')).to.be.undefined;\n      expect(base.getHeader('one')).to.be.undefined;\n    });\n\n    it('.hasHeader()', function () {\n      const { headers } = base;\n\n      base.setHeader('One', '1');\n      expect(headers).to.deep.equal({ one: '1' });\n\n      expect(base.hasHeader('One')).to.be.true;\n      expect(base.hasHeader('one')).to.be.true;\n      expect(base.hasHeader('Two')).to.be.false;\n\n      base.removeHeader('One');\n      expect(base.hasHeader('One')).to.be.false;\n      expect(base.hasHeader('one')).to.be.false;\n    });\n\n    it('.setHeader()', function () {\n      const { headers } = base;\n\n      base.setHeader('One', '1');\n      expect(headers).to.deep.equal({ one: '1' });\n\n      base.setHeader('two', '2');\n      expect(headers).to.deep.equal({ one: '1', two: '2' });\n\n      base.setHeader('Two', null);\n      expect(headers).to.deep.equal({ one: '1' });\n    });\n\n    it('.setHeaders()', function () {\n      const { headers } = base;\n\n      base.setHeaders({ One: '1', two: '2' });\n      expect(headers).to.deep.equal({ one: '1', two: '2' });\n\n      base.setHeaders({ Three: '3' });\n      expect(headers).to.deep.equal({ one: '1', two: '2', three: '3' });\n\n      base.setHeaders({ Three: null });\n      expect(headers).to.deep.equal({ one: '1', two: '2' });\n    });\n\n    it('.removeHeader()', function () {\n      const { headers } = base;\n\n      base.setHeaders({ One: '1', Two: '2' });\n\n      base.removeHeader('One');\n      expect(headers).to.deep.equal({ two: '2' });\n\n      base.removeHeader('two');\n      expect(headers).to.deep.equal({});\n    });\n\n    it('.removeHeaders()', function () {\n      const { headers } = base;\n\n      base.setHeaders({ One: '1', Two: '2' });\n\n      base.removeHeaders(['One', 'two']);\n      expect(headers).to.deep.equal({});\n    });\n\n    it('.type()', function () {\n      base.type('text/plain');\n      expect(base.getHeader('Content-Type')).to.equal('text/plain');\n    });\n\n    it('.send() - string', function () {\n      base.send('foo');\n\n      expect(base.body).to.equal('foo');\n      expect(base.getHeader('Content-Type')).to.equal(\n        'text/html; charset=utf-8'\n      );\n    });\n\n    it('.send() - boolean, number, & object', function () {\n      [true, 200, {}].forEach((body) => {\n        base.type();\n        base.send(body);\n\n        expect(base.body).to.equal(stringify(body));\n        expect(base.getHeader('Content-Type')).to.equal(\n          'application/json; charset=utf-8'\n        );\n      });\n    });\n\n    it('.send() - null & undefined', function () {\n      base.type();\n      base.send(null);\n      expect(base.body).to.equal('');\n      expect(base.hasHeader('Content-Type')).to.be.false;\n\n      base.type();\n      base.send();\n      expect(base.body).to.be.undefined;\n      expect(base.hasHeader('Content-Type')).to.be.false;\n    });\n\n    it('.send() - should not override existing type', function () {\n      base.type('text/plain; charset=utf-9000');\n      base.send('foo');\n\n      expect(base.body).to.equal('foo');\n      expect(base.getHeader('Content-Type')).to.equal(\n        'text/plain; charset=utf-9000'\n      );\n    });\n\n    it('.json()', function () {\n      const obj = { foo: 'bar' };\n\n      base.json(obj);\n\n      expect(base.body).to.equal(stringify(obj));\n      expect(base.getHeader('Content-Type')).to.equal(\n        'application/json; charset=utf-8'\n      );\n    });\n\n    it('.json() - should not override existing type', function () {\n      const obj = { foo: 'bar' };\n\n      base.type('text/plain; charset=utf-9000');\n      base.send(obj);\n\n      expect(base.body).to.equal(stringify(obj));\n      expect(base.getHeader('Content-Type')).to.equal(\n        'text/plain; charset=utf-9000'\n      );\n    });\n\n    it('.jsonBody()', function () {\n      const obj = { foo: 'bar' };\n\n      expect(() => base.jsonBody()).to.throw(Error);\n\n      base.json(obj);\n      expect(base.jsonBody()).to.deep.equal(obj);\n    });\n\n    it('.end()', function () {\n      base.setHeader('foo', 'bar');\n\n      expect(base.headers).to.deep.equal({ foo: 'bar' });\n\n      base.end();\n      expect(() => base.setHeader('bar', 'baz')).to.throw();\n      expect(base.headers).to.deep.equal({ foo: 'bar' });\n    });\n\n    it('should be chainable', function () {\n      expect(base.setHeader('one', '1')).to.equal(base);\n      expect(base.setHeaders({ one: '1' })).to.equal(base);\n      expect(base.type('text/plain')).to.equal(base);\n      expect(base.send('body')).to.equal(base);\n      expect(base.json({ foo: 'bar' })).to.equal(base);\n      expect(base.end()).to.equal(base);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/interceptor-test.js",
    "content": "import Interceptor from '../../../src/-private/interceptor';\n\ndescribe('Unit | Interceptor', function () {\n  it('should exist', function () {\n    expect(Interceptor).to.be.a('function');\n  });\n\n  it('should have the correct defaults', function () {\n    const interceptor = new Interceptor();\n\n    expect(interceptor.type).to.equal('intercept');\n    expect(interceptor.shouldAbort).to.be.false;\n    expect(interceptor.shouldPassthrough).to.be.false;\n    expect(interceptor.shouldIntercept).to.be.true;\n    expect(interceptor.shouldStopPropagating).to.be.false;\n  });\n\n  it('should disable passthrough when calling abort and vise versa', function () {\n    const interceptor = new Interceptor();\n\n    expect(interceptor.shouldAbort).to.be.false;\n    expect(interceptor.shouldPassthrough).to.be.false;\n\n    interceptor.abort();\n    expect(interceptor.shouldAbort).to.be.true;\n    expect(interceptor.shouldPassthrough).to.be.false;\n\n    interceptor.passthrough();\n    expect(interceptor.shouldAbort).to.be.false;\n    expect(interceptor.shouldPassthrough).to.be.true;\n  });\n\n  it('.abort()', function () {\n    const interceptor = new Interceptor();\n\n    expect(interceptor.shouldAbort).to.be.false;\n    expect(interceptor.shouldIntercept).to.be.true;\n\n    interceptor.abort();\n\n    expect(interceptor.shouldAbort).to.be.true;\n    expect(interceptor.shouldIntercept).to.be.false;\n  });\n\n  it('.passthrough()', function () {\n    const interceptor = new Interceptor();\n\n    expect(interceptor.shouldPassthrough).to.be.false;\n    expect(interceptor.shouldIntercept).to.be.true;\n\n    interceptor.passthrough();\n\n    expect(interceptor.shouldPassthrough).to.be.true;\n    expect(interceptor.shouldIntercept).to.be.false;\n  });\n\n  it('.stopPropagation()', function () {\n    const interceptor = new Interceptor();\n\n    expect(interceptor.shouldStopPropagating).to.be.false;\n    interceptor.stopPropagation();\n    expect(interceptor.shouldStopPropagating).to.be.true;\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/-private/response-test.js",
    "content": "import { PollyError } from '@pollyjs/utils';\n\nimport PollyResponse from '../../../src/-private/response';\n\nlet response;\n\ndescribe('Unit | Response', function () {\n  it('should exist', function () {\n    expect(() => new PollyResponse()).to.not.throw();\n    expect(new PollyResponse()).to.exist;\n  });\n\n  it('should have a default status code of 200', function () {\n    expect(new PollyResponse().statusCode).to.equal(200);\n  });\n\n  it('should default encoding to undefined', function () {\n    expect(new PollyResponse().encoding).to.be.undefined;\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      response = new PollyResponse();\n    });\n\n    it('.status()', function () {\n      [100, '404', 500, '599'].forEach((statusCode) => {\n        expect(response.status(statusCode).statusCode).to.equal(\n          Number(statusCode)\n        );\n      });\n\n      [null, '', 0, 99, 600, 999].forEach((statusCode) => {\n        expect(() => response.status(statusCode)).to.throw(\n          PollyError,\n          /Invalid status code/\n        );\n      });\n    });\n\n    it('.sendStatus()', function () {\n      response.sendStatus(200);\n\n      expect(response.body).to.equal('OK');\n      expect(response.getHeader('Content-Type')).to.equal(\n        'text/plain; charset=utf-8'\n      );\n    });\n\n    it('.end()', function () {\n      response.status(200);\n      response.setHeader('foo', 'bar');\n\n      expect(response.statusCode).to.equal(200);\n      expect(response.headers).to.deep.equal({ foo: 'bar' });\n\n      response.end();\n      expect(() => response.status(404)).to.throw();\n      expect(() => response.setHeader('bar', 'baz')).to.throw();\n\n      expect(response.statusCode).to.equal(200);\n      expect(response.headers).to.deep.equal({ foo: 'bar' });\n    });\n\n    it('should be chainable', function () {\n      expect(response.status(200)).to.equal(response);\n      expect(response.sendStatus(200)).to.equal(response);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/index-test.js",
    "content": "import * as PollyExports from '../../src';\n\ndescribe('Unit | Index', function () {\n  it('should export all the necessary modules', function () {\n    ['Polly', 'Timing', 'setupQunit', 'setupMocha'].forEach((name) => {\n      expect(PollyExports[name]).to.be.ok;\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/polly-test.js",
    "content": "import Adapter from '@pollyjs/adapter';\nimport Persister from '@pollyjs/persister';\nimport { MODES, PollyError } from '@pollyjs/utils';\n\nimport defaults from '../../src/defaults/config';\nimport Polly from '../../src/polly';\nimport { Container } from '../../src/-private/container';\nimport setupPolly from '../../src/test-helpers/mocha';\n\ndescribe('Unit | Polly', function () {\n  it('should exist', function () {\n    expect(Polly).to.be.a('function');\n  });\n\n  it('should have a version', function () {\n    expect(Polly.VERSION).to.be.a('string');\n  });\n\n  it('should instantiate without throwing', async function () {\n    await expect(async function () {\n      const polly = new Polly('recording name');\n\n      await polly.stop();\n    }).to.not.throw();\n  });\n\n  it('should throw with an empty recording name', async function () {\n    for (const value of [undefined, null, '', '\\n\\r']) {\n      const polly = new Polly('test');\n\n      expect(() => (polly.recordingName = value)).to.throw(\n        PollyError,\n        /Invalid recording name provided/\n      );\n\n      await polly.stop();\n    }\n  });\n\n  it('should be able to change the recording name', async function () {\n    const polly = new Polly('squawk');\n\n    expect(polly.recordingName).to.equal('squawk');\n    polly.recordingName = 'squawk squawk';\n    expect(polly.recordingName).to.equal('squawk squawk');\n\n    await polly.stop();\n  });\n\n  it('should update the recording id when the name changes', async function () {\n    const polly = new Polly('squawk');\n\n    expect(polly.recordingName).to.equal('squawk');\n    expect(polly.recordingId).to.contain('squawk');\n    polly.recordingName = 'chirp';\n    expect(polly.recordingName).to.equal('chirp');\n    expect(polly.recordingId).to.contain('chirp');\n\n    await polly.stop();\n  });\n\n  it('can manually set the mode', async function () {\n    const polly = new Polly('squawk');\n\n    expect(polly.mode).to.equal('replay');\n    polly.mode = 'record';\n    expect(polly.mode).to.equal('record');\n\n    await polly.stop();\n  });\n\n  it('throws on an invalid mode', async function () {\n    const polly = new Polly('squawk');\n\n    expect(() => (polly.mode = 'INVALID')).to.throw(\n      PollyError,\n      /Invalid mode provided/\n    );\n\n    await polly.stop();\n  });\n\n  it('it supports custom adapters', async function () {\n    let connectCalled, disconnectCalled;\n\n    class MockAdapter extends Adapter {\n      static get id() {\n        return 'mock';\n      }\n\n      onConnect() {\n        connectCalled = true;\n      }\n\n      onDisconnect() {\n        disconnectCalled = true;\n      }\n    }\n\n    const polly = new Polly('recording name', { adapters: [MockAdapter] });\n\n    await polly.stop();\n\n    expect(connectCalled).to.be.true;\n    expect(disconnectCalled).to.be.true;\n  });\n\n  it('it supports custom persisters', async function () {\n    let instantiated, persistCalled;\n\n    class MockPersister extends Persister {\n      static get id() {\n        return 'mock';\n      }\n\n      constructor() {\n        super(...arguments);\n        instantiated = true;\n      }\n\n      persist() {\n        persistCalled = true;\n        super.persist(...arguments);\n      }\n    }\n\n    const polly = new Polly('recording name', { persister: MockPersister });\n\n    await polly.stop();\n\n    expect(instantiated).to.be.true;\n    expect(persistCalled).to.be.true;\n  });\n\n  it('calls flush when flushRequestsOnStop is enabled', async function () {\n    let polly = new Polly('squawk', { flushRequestsOnStop: false });\n    let flushCalled = false;\n\n    polly.flush = async () => {\n      flushCalled = true;\n    };\n\n    await polly.stop();\n    expect(flushCalled).to.be.false;\n\n    polly = new Polly('squawk', { flushRequestsOnStop: true });\n    flushCalled = false;\n\n    polly.flush = async () => {\n      flushCalled = true;\n    };\n\n    await polly.stop();\n    expect(flushCalled).to.be.true;\n  });\n\n  describe('configure', function () {\n    setupPolly();\n\n    it('should not be configurable once requests are handled', async function () {\n      this.polly._requests.push({});\n      expect(() => this.polly.configure()).to.throw(\n        PollyError,\n        'Cannot call `configure` once requests have been handled.'\n      );\n    });\n\n    it('should not be configurable once stopped', async function () {\n      await this.polly.stop();\n\n      expect(() => this.polly.configure()).to.throw(\n        PollyError,\n        'Cannot call `configure` on an instance of Polly that is not running.'\n      );\n    });\n\n    it('should deep merge configure options with defaults', async function () {\n      this.polly.configure({\n        matchRequestsBy: {\n          url: {\n            port: !defaults.matchRequestsBy.url.port\n          }\n        }\n      });\n\n      expect(this.polly.config.matchRequestsBy.url.port).to.be.false;\n      expect(this.polly.config.matchRequestsBy.url).to.deep.equal({\n        ...defaults.matchRequestsBy.url,\n        port: !defaults.matchRequestsBy.url.port\n      });\n    });\n\n    it('should not deep merge adapter options', async function () {\n      class MockAdapterA extends Adapter {\n        static get id() {\n          return 'mock-a';\n        }\n\n        onConnect() {}\n        onDisconnect() {}\n      }\n\n      class MockAdapterB extends MockAdapterA {\n        static get id() {\n          return 'mock-b';\n        }\n      }\n\n      expect(this.polly.config.adapters.length).to.equal(0);\n\n      this.polly.configure({ adapters: [MockAdapterA] });\n      this.polly.configure({ adapters: [MockAdapterB] });\n\n      expect(this.polly.config.adapters.length).to.equal(1);\n      expect(this.polly.adapters.has('mock-a')).to.be.false;\n      expect(this.polly.adapters.has('mock-b')).to.be.true;\n    });\n\n    it('should connect to new adapters', async function () {\n      let connectCalled = false;\n\n      class MockAdapter extends Adapter {\n        static get id() {\n          return 'mock';\n        }\n\n        onConnect() {\n          connectCalled = true;\n        }\n        onDisconnect() {}\n      }\n\n      expect(connectCalled).to.be.false;\n      this.polly.configure({ adapters: [MockAdapter] });\n      expect(connectCalled).to.be.true;\n    });\n\n    it('should disconnect from adapters before connecting', async function () {\n      let connectCount = 0;\n      let disconnectCount = 0;\n\n      class MockAdapter extends Adapter {\n        static get id() {\n          return 'mock';\n        }\n\n        onConnect() {\n          connectCount++;\n        }\n        onDisconnect() {\n          disconnectCount++;\n        }\n      }\n\n      this.polly.configure({ adapters: [MockAdapter] });\n      expect(connectCount).to.equal(1);\n      expect(disconnectCount).to.equal(0);\n\n      this.polly.configure({ adapters: [MockAdapter] });\n      expect(connectCount).to.equal(2);\n      expect(disconnectCount).to.equal(1);\n    });\n  });\n\n  describe('API', function () {\n    setupPolly();\n\n    class MockAdapterA extends Adapter {\n      static get id() {\n        return 'adapter-a';\n      }\n\n      onConnect() {}\n      onDisconnect() {}\n    }\n\n    class MockAdapterB extends MockAdapterA {\n      static get id() {\n        return 'adapter-b';\n      }\n    }\n\n    it('.record()', async function () {\n      this.polly.mode = MODES.REPLAY;\n\n      expect(this.polly.mode).to.equal(MODES.REPLAY);\n      this.polly.record();\n      expect(this.polly.mode).to.equal(MODES.RECORD);\n    });\n\n    it('.replay()', async function () {\n      this.polly.mode = MODES.RECORD;\n\n      expect(this.polly.mode).to.equal(MODES.RECORD);\n      this.polly.replay();\n      expect(this.polly.mode).to.equal(MODES.REPLAY);\n    });\n\n    it('.passthrough()', async function () {\n      this.polly.mode = MODES.RECORD;\n\n      expect(this.polly.mode).to.equal(MODES.RECORD);\n      this.polly.passthrough();\n      expect(this.polly.mode).to.equal(MODES.PASSTHROUGH);\n    });\n\n    it('.pause()', async function () {\n      this.polly.configure({ adapters: [MockAdapterA, MockAdapterB] });\n\n      expect([...this.polly.adapters.keys()]).to.deep.equal([\n        'adapter-a',\n        'adapter-b'\n      ]);\n      this.polly.pause();\n      expect([...this.polly.adapters.keys()]).to.deep.equal([]);\n    });\n\n    it('.play()', async function () {\n      this.polly.configure({ adapters: [MockAdapterA, MockAdapterB] });\n\n      expect([...this.polly.adapters.keys()]).to.deep.equal([\n        'adapter-a',\n        'adapter-b'\n      ]);\n      this.polly.play();\n      expect([...this.polly.adapters.keys()]).to.deep.equal([\n        'adapter-a',\n        'adapter-b'\n      ]);\n      this.polly.pause();\n      expect([...this.polly.adapters.keys()]).to.deep.equal([]);\n      this.polly.play();\n      expect([...this.polly.adapters.keys()]).to.deep.equal([\n        'adapter-a',\n        'adapter-b'\n      ]);\n    });\n\n    it('.stop()', async function () {\n      this.polly.mode = MODES.RECORD;\n      expect(this.polly.mode).to.equal(MODES.RECORD);\n\n      const promise = this.polly.stop();\n\n      expect(promise).to.be.a('promise');\n      await promise;\n      expect(this.polly.mode).to.equal(MODES.STOPPED);\n    });\n\n    it('.connectTo()', async function () {\n      let connectCount = 0;\n      let disconnectCount = 0;\n\n      class MockAdapter extends Adapter {\n        static get id() {\n          return 'mock';\n        }\n\n        onConnect() {\n          connectCount++;\n        }\n\n        onDisconnect() {\n          disconnectCount++;\n        }\n      }\n\n      this.polly.container.register(MockAdapter);\n\n      this.polly.connectTo('mock');\n      expect(connectCount).to.equal(1);\n      expect(disconnectCount).to.equal(0);\n\n      this.polly.connectTo(MockAdapter);\n      expect(connectCount).to.equal(2);\n      expect(disconnectCount).to.equal(1);\n    });\n\n    it('.disconnectTo()', async function () {\n      let connectCount = 0;\n      let disconnectCount = 0;\n\n      class MockAdapter extends Adapter {\n        static get id() {\n          return 'mock';\n        }\n\n        onConnect() {\n          connectCount++;\n        }\n\n        onDisconnect() {\n          disconnectCount++;\n        }\n      }\n\n      this.polly.container.register(MockAdapter);\n\n      this.polly.connectTo('mock');\n      expect(connectCount).to.equal(1);\n      this.polly.disconnectFrom('mock');\n      expect(disconnectCount).to.equal(1);\n\n      this.polly.connectTo(MockAdapter);\n      expect(connectCount).to.equal(2);\n      this.polly.disconnectFrom(MockAdapter);\n      expect(disconnectCount).to.equal(2);\n    });\n\n    it('.disconnect()', async function () {\n      const disconnects = [];\n\n      class MockAdapterA extends Adapter {\n        static get id() {\n          return 'mock-a';\n        }\n\n        onConnect() {}\n\n        onDisconnect() {\n          disconnects.push(true);\n        }\n      }\n\n      class MockAdapterB extends MockAdapterA {\n        static get id() {\n          return 'mock-b';\n        }\n      }\n\n      // configure automatically connects to the new adapter\n      this.polly.configure({ adapters: [MockAdapterA, MockAdapterB] });\n\n      expect(disconnects.length).to.equal(0);\n      expect(this.polly.disconnect());\n      expect(disconnects.length).to.equal(2);\n    });\n\n    it('.flush()', async function () {\n      const promise = this.polly.flush();\n\n      expect(promise).to.be.a('promise');\n      await promise;\n    });\n  });\n\n  describe('Class Methods & Events', function () {\n    it('should be event-able', function () {\n      expect(Polly.on).to.be.a('function');\n      expect(Polly.once).to.be.a('function');\n      expect(Polly.off).to.be.a('function');\n    });\n\n    describe('Methods', function () {\n      class MockAdapter extends Adapter {\n        static get id() {\n          return 'mock';\n        }\n      }\n\n      it('.register()', async function () {\n        Polly.register(MockAdapter);\n\n        const polly = new Polly('Test');\n\n        expect(polly.container.has('adapter:mock')).to.be.true;\n\n        await polly.stop();\n        Polly.unregister(MockAdapter);\n      });\n\n      it('.unregister()', async function () {\n        Polly.register(MockAdapter);\n\n        let polly = new Polly('Test');\n\n        expect(polly.container.has('adapter:mock')).to.be.true;\n        await polly.stop();\n\n        Polly.unregister(MockAdapter);\n\n        polly = new Polly('Test');\n        expect(polly.container.has('adapter:mock')).to.be.false;\n        await polly.stop();\n      });\n    });\n\n    describe('Events', function () {\n      it('register', async function () {\n        let registerCalled = false;\n\n        Polly.once('register', (container) => {\n          expect(container).to.be.an.instanceof(Container);\n          registerCalled = true;\n        });\n\n        const polly = new Polly('Test');\n\n        expect(registerCalled).to.be.true;\n        await polly.stop();\n      });\n\n      it('create', async function () {\n        let createCalled = false;\n\n        Polly.once('create', (polly) => {\n          expect(polly).to.be.an.instanceof(Polly);\n          createCalled = true;\n        });\n\n        const polly = new Polly('Test');\n\n        expect(createCalled).to.be.true;\n        await polly.stop();\n      });\n\n      it('create - should throw with an async listener', async function () {\n        Polly.once('create', () => {});\n        Polly.once('create', () => Promise.resolve());\n\n        expect(() => new Polly('Test')).to.throw(PollyError);\n      });\n\n      it('create - configuration order should be preserved', async function () {\n        Polly.once('create', (polly) => {\n          polly.configure({ logLevel: 'info', recordIfMissing: false });\n        });\n\n        const polly = new Polly('Test', { recordIfMissing: true });\n\n        expect(polly.config.logLevel).to.equal('info');\n        expect(polly.config.recordIfMissing).to.be.true;\n        await polly.stop();\n      });\n\n      it('stop', async function () {\n        let stopCalled = false;\n\n        Polly.once('stop', (polly) => {\n          expect(polly).to.be.an.instanceof(Polly);\n          expect(polly.mode).to.equal(MODES.STOPPED);\n          stopCalled = true;\n        });\n\n        const polly = new Polly('Test');\n\n        await polly.stop();\n        expect(stopCalled).to.be.true;\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/server/handler-test.js",
    "content": "import Handler from '../../../src/server/handler';\n\ndescribe('Unit | Server | Handler', function () {\n  it('should exist', function () {\n    expect(Handler).to.be.a('function');\n  });\n\n  describe('Events', function () {\n    it('throws on registering an unknown event name', function () {\n      expect(() => new Handler().on('unknownEventName')).to.throw(\n        /Invalid event name provided/\n      );\n    });\n\n    it('throws on un-registering an unknown event name', function () {\n      expect(() => new Handler().off('unknownEventName')).to.throw(\n        /Invalid event name provided/\n      );\n    });\n\n    it('registers a known event via .on()', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n\n      handler.on('request', () => {});\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      handler.on('request', () => {});\n      expect(eventEmitter.listeners('request')).to.have.lengthOf(2);\n    });\n\n    it('registers a known event via .on() with { times }', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n\n      handler.on('request', () => {}, { times: 2 });\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n    });\n\n    it('registers a known event via .on() with .times()', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n\n      handler.times(2).on('request', () => {});\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n    });\n\n    it('registers a known event via .on() with .times() and override with { times }', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n\n      handler.times(2).on('request', () => {}, { times: 1 });\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n    });\n\n    it('registers a known event via .once()', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n\n      handler.once('request', () => {});\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n\n      handler.once('request', () => {});\n      expect(eventEmitter.listeners('request')).to.have.lengthOf(2);\n\n      eventEmitter.emitSync('request');\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n    });\n\n    it('un-registers a known event via .off()', function () {\n      const handler = new Handler();\n      const { _eventEmitter: eventEmitter } = handler;\n      const fn = () => {};\n\n      handler.on('request', fn);\n      handler.on('request', () => {});\n      handler.on('request', () => {});\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n      expect(eventEmitter.listeners('request')).to.have.lengthOf(3);\n\n      handler.off('request', fn);\n      expect(eventEmitter.hasListeners('request')).to.be.true;\n      expect(eventEmitter.listeners('request')).to.have.lengthOf(2);\n      expect(eventEmitter.listeners('request').includes(fn)).to.be.false;\n\n      handler.off('request');\n      expect(eventEmitter.hasListeners('request')).to.be.false;\n      expect(eventEmitter.listeners('request')).to.have.lengthOf(0);\n    });\n  });\n\n  describe('.intercept()', function () {\n    it('registers an intercept handler', function () {\n      const handler = new Handler();\n\n      handler.intercept(() => {});\n      expect(handler.has('intercept')).to.be.true;\n    });\n\n    it('throws when passing a non-function to intercept', function () {\n      const handler = new Handler();\n\n      [null, undefined, {}, [], ''].forEach((value) => {\n        expect(() => handler.intercept(value)).to.throw(\n          /Invalid intercept handler provided/\n        );\n      });\n    });\n\n    it('throws when passing an invalid times option', function () {\n      const handler = new Handler();\n\n      ['1', -1, 0].forEach((times) => {\n        expect(() => handler.intercept(() => {}, { times })).to.throw(\n          /Invalid number provided/\n        );\n      });\n    });\n\n    it('registers an intercept handler with { times }', function () {\n      const handler = new Handler();\n\n      handler.intercept(() => {}, { times: 2 });\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.get('intercept')();\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.get('intercept')();\n      expect(handler.has('intercept')).to.be.false;\n    });\n\n    it('registers an intercept handler with .times()', function () {\n      const handler = new Handler();\n\n      handler.times(2).intercept(() => {});\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.get('intercept')();\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.get('intercept')();\n      expect(handler.has('intercept')).to.be.false;\n    });\n\n    it('registers an intercept handler with .times() and override with { times }', function () {\n      const handler = new Handler();\n\n      handler.times(2).intercept(() => {}, { times: 1 });\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.get('intercept')();\n      expect(handler.has('intercept')).to.be.false;\n    });\n  });\n\n  describe('.passthrough()', function () {\n    it('should work', function () {\n      const handler = new Handler();\n\n      expect(handler.has('passthrough')).to.be.false;\n\n      handler.passthrough();\n      expect(handler.get('passthrough')).to.be.true;\n\n      handler.passthrough(false);\n      expect(handler.get('passthrough')).to.be.false;\n    });\n\n    it('removes the intercept handler on passthrough', function () {\n      const handler = new Handler();\n\n      handler.intercept(() => {});\n      expect(handler.has('intercept')).to.be.true;\n\n      handler.passthrough();\n      expect(handler.get('passthrough')).to.be.true;\n      expect(handler.has('intercept')).to.be.false;\n    });\n\n    it('disables passthrough on intercept', function () {\n      const handler = new Handler();\n\n      handler.passthrough();\n      expect(handler.get('passthrough')).to.be.true;\n      expect(handler.has('intercept')).to.be.false;\n\n      handler.intercept(() => {});\n      expect(handler.has('intercept')).to.be.true;\n      expect(handler.get('passthrough')).to.be.false;\n    });\n  });\n\n  describe('.recordingName()', function () {\n    it('should work', function () {\n      const handler = new Handler();\n\n      expect(handler.has('recordingName')).to.be.false;\n\n      handler.recordingName('Test');\n      expect(handler.get('recordingName')).to.equal('Test');\n\n      handler.recordingName();\n      expect(handler.has('recordingName')).to.be.true;\n      expect(handler.get('recordingName')).to.be.undefined;\n    });\n\n    it('should allow setting a falsy recordingName', function () {\n      const handler = new Handler();\n\n      expect(handler.has('recordingName')).to.be.false;\n\n      [false, undefined, null].forEach((value) => {\n        handler.recordingName(value);\n        expect(handler.has('recordingName')).to.be.true;\n        expect(handler.get('recordingName')).to.equal(value);\n      });\n    });\n\n    it('throws when passing an invalid truthy recording name', function () {\n      const handler = new Handler();\n\n      [1, {}, [], true].forEach((value) => {\n        expect(() => handler.recordingName(value)).to.throw(\n          /Invalid recording name provided/\n        );\n      });\n    });\n  });\n\n  describe('.configure()', function () {\n    it('should work', function () {\n      const handler = new Handler();\n\n      expect(handler.get('config')).to.deep.equal({});\n\n      handler.configure({ logLevel: 'info' });\n      expect(handler.get('config')).to.deep.equal({ logLevel: 'info' });\n\n      handler.configure({ recordIfMissing: false });\n      expect(handler.get('config')).to.deep.equal({ recordIfMissing: false });\n\n      handler.configure({});\n      expect(handler.get('config')).to.deep.equal({});\n    });\n\n    it('throws when passing an invalid config', function () {\n      const handler = new Handler();\n\n      [false, true, null, undefined, 1, []].forEach((config) => {\n        expect(() => handler.configure(config)).to.throw(\n          /Invalid config provided/\n        );\n      });\n\n      [\n        'mode',\n        'adapters',\n        'adapterOptions',\n        'persister',\n        'persisterOptions'\n      ].forEach((key) => {\n        expect(() => handler.configure({ [key]: key })).to.throw(\n          /Invalid configuration option provided/\n        );\n      });\n    });\n  });\n\n  describe('.filter()', function () {\n    it('should work', function () {\n      const handler = new Handler();\n      const filters = handler.get('filters');\n      const fn = () => {};\n\n      expect(filters.size).to.equal(0);\n\n      handler.filter(fn);\n      expect(filters.size).to.equal(1);\n\n      handler.filter(fn);\n      expect(filters.size).to.equal(1);\n\n      handler.filter(() => {});\n      expect(filters.size).to.equal(2);\n    });\n\n    it('throws when passing an invalid fn', function () {\n      const handler = new Handler();\n\n      [false, true, null, undefined, 1, [], {}, ''].forEach((fn) => {\n        expect(() => handler.filter(fn)).to.throw(\n          /Invalid filter callback provided/\n        );\n      });\n    });\n  });\n\n  describe('.times()', function () {\n    it('should work', function () {\n      const handler = new Handler();\n      const defaultOptions = handler.get('defaultOptions');\n\n      expect(defaultOptions).to.deep.equal({});\n\n      handler.times(1);\n      expect(defaultOptions).to.deep.equal({ times: 1 });\n\n      handler.times(2);\n      expect(defaultOptions).to.deep.equal({ times: 2 });\n\n      handler.times();\n      expect(defaultOptions).to.deep.equal({});\n    });\n\n    it('throws when passing an invalid times option', function () {\n      const handler = new Handler();\n\n      ['1', -1, 0].forEach((times) => {\n        expect(() => handler.times(times)).to.throw(/Invalid number provided/);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/server/server-test.js",
    "content": "import { HTTP_METHODS } from '@pollyjs/utils';\n\nimport Server from '../../../src/server';\n\nlet server;\n\nfunction request(method, path) {\n  return server.lookup(method, path).handlers[0].get('intercept')();\n}\n\ndescribe('Unit | Server', function () {\n  it('should exist', function () {\n    expect(() => new Server()).to.not.throw();\n    expect(new Server()).to.exist;\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      server = new Server();\n    });\n\n    it('should handle all HTTP methods', function () {\n      HTTP_METHODS.forEach((method) => {\n        server[method.toLowerCase()]('/foo').intercept(() => 200);\n        expect(request(method, '/foo')).to.equal(200);\n      });\n    });\n\n    it('should handle multiple routes on all HTTP methods', function () {\n      HTTP_METHODS.forEach((method) => {\n        server[method.toLowerCase()]([\n          `/${method}`,\n          `/${method}/*path`\n        ]).intercept(() => 200);\n\n        expect(request(method, `/${method}`)).to.equal(200);\n        expect(request(method, `/${method}/foo/bar`)).to.equal(200);\n      });\n    });\n\n    it('should handle dynamic segments', function () {\n      server.get('/foo/:seg1').intercept(() => 200);\n      server.get('/foo/:seg1/bar/:seg2').intercept(() => 400);\n\n      expect(request('GET', '/foo/42')).to.equal(200);\n      expect(request('GET', '/foo/super-secret-guid')).to.equal(200);\n\n      expect(request('GET', '/foo/42/bar/abc')).to.equal(400);\n    });\n\n    it('should differentiate hosts with different protocols', function () {\n      ['http', 'https'].forEach((protocol) => {\n        server.get(`${protocol}://foo.bar`).intercept(() => protocol);\n        expect(request('GET', `${protocol}://foo.bar`)).to.equal(protocol);\n      });\n    });\n\n    it('can be scoped to a host', function () {\n      server.host('http://foo.bar', () => {\n        server.get('/baz').intercept(() => 200);\n      });\n\n      expect(request('GET', 'http://foo.bar/baz')).to.equal(200);\n    });\n\n    it('can handle index route registration', function () {\n      server.host('http://foo', () => {\n        server.get('/').intercept(() => 200);\n      });\n\n      expect(request('GET', 'http://foo')).to.equal(200);\n      expect(request('GET', 'http://foo/')).to.equal(200);\n    });\n\n    it('should reset the host after scoping', function () {\n      server.host('http://foo.bar', () => {});\n      server.get('/foo').intercept(() => 200);\n\n      expect(() => request('GET', 'http://foo.bar/foo')).to.throw();\n      expect(request('GET', '/foo')).to.equal(200);\n    });\n\n    it('should throw when nesting hosts', function () {\n      expect(() => {\n        server.host('http://foo.bar', () => {\n          server.host('http://bar.baz', () => {});\n        });\n      }).to.throw();\n    });\n\n    it('should reset the namespace after scoping', function () {\n      server.namespace('/api', () => {});\n      server.get('/foo').intercept(() => 200);\n\n      expect(() => request('GET', '/api/foo')).to.throw();\n      expect(request('GET', '/foo')).to.equal(200);\n    });\n\n    it('can be scoped to multiple namespaces', function () {\n      server.namespace('/api', () => {\n        server.get('/foo').intercept(() => 'foo');\n\n        server.namespace('/v2', () => {\n          server.get('/bar').intercept(() => 'bar');\n        });\n      });\n\n      expect(request('GET', '/api/foo')).to.equal('foo');\n      expect(request('GET', '/api/v2/bar')).to.equal('bar');\n    });\n  });\n\n  describe('Route Matching', function () {\n    beforeEach(function () {\n      server = new Server();\n    });\n\n    function addHandlers(url) {\n      server.get(url).on('request', () => {});\n      server.get(url).on('response', () => {});\n      server.get(url).intercept(() => {});\n    }\n\n    it('should concat handlers for same paths', async function () {\n      [\n        '/ping',\n        '/ping/:id',\n        '/ping/*path',\n        'http://ping.com',\n        'http://ping.com/pong/:id',\n        'http://ping.com/pong/*path'\n      ].forEach((url) => {\n        addHandlers(url);\n        expect(server.lookup('GET', url).handlers).to.have.lengthOf(3);\n      });\n    });\n\n    it('should concat handlers for same paths with a trailing slash', async function () {\n      addHandlers('/ping');\n      expect(server.lookup('GET', '/ping').handlers).to.have.lengthOf(3);\n\n      addHandlers('/ping/');\n      expect(server.lookup('GET', '/ping').handlers).to.have.lengthOf(6);\n      expect(server.lookup('GET', '/ping/').handlers).to.have.lengthOf(6);\n\n      addHandlers('http://ping.com');\n      expect(server.lookup('GET', 'http://ping.com').handlers).to.have.lengthOf(\n        3\n      );\n\n      addHandlers('http://ping.com/');\n      expect(server.lookup('GET', 'http://ping.com').handlers).to.have.lengthOf(\n        6\n      );\n      expect(\n        server.lookup('GET', 'http://ping.com/').handlers\n      ).to.have.lengthOf(6);\n    });\n\n    it('should concat handlers for same paths with different dynamic segment names', async function () {\n      addHandlers('/ping/:id');\n      expect(server.lookup('GET', '/ping/:id').handlers).to.have.lengthOf(3);\n\n      addHandlers('/ping/:uuid');\n      expect(server.lookup('GET', '/ping/:id').handlers).to.have.lengthOf(6);\n      expect(server.lookup('GET', '/ping/:uuid').handlers).to.have.lengthOf(6);\n    });\n\n    it('should concat handlers for same paths with different star segment names', async function () {\n      addHandlers('/ping/*path');\n      expect(server.lookup('GET', '/ping/*path').handlers).to.have.lengthOf(3);\n\n      addHandlers('/ping/*rest');\n      expect(server.lookup('GET', '/ping/*path').handlers).to.have.lengthOf(6);\n      expect(server.lookup('GET', '/ping/*rest').handlers).to.have.lengthOf(6);\n    });\n\n    it('should concat handlers for same paths with different dynamic and star segment names', async function () {\n      addHandlers('/ping/:id/pong/*path');\n      expect(\n        server.lookup('GET', '/ping/:id/pong/*path').handlers\n      ).to.have.lengthOf(3);\n\n      addHandlers('/ping/:uuid/pong/*rest');\n      expect(\n        server.lookup('GET', '/ping/:id/pong/*path').handlers\n      ).to.have.lengthOf(6);\n      expect(\n        server.lookup('GET', '/ping/:uuid/pong/*rest').handlers\n      ).to.have.lengthOf(6);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/test-helpers/mocha-test.js",
    "content": "import setupPolly from '../../../src/test-helpers/mocha';\n\nclass Sandbox {\n  constructor(context) {\n    this.beforeEachCalled = new Set();\n    this.afterEachCalled = new Set();\n    this.context = context || { currentTest: { title: 'mockname' } };\n  }\n\n  beforeEach(fn) {\n    this.beforeEachCalled.add(fn);\n    fn.call(this.context, undefined);\n  }\n\n  afterEach(fn) {\n    this.afterEachCalled.add(fn);\n    fn.call(this.context, undefined);\n  }\n}\n\ndescribe('Unit | Test Helpers | mocha', function () {\n  it('should exist', function () {\n    expect(setupPolly).to.be.a('function');\n    expect(setupPolly.beforeEach).to.be.a('function');\n    expect(setupPolly.afterEach).to.be.a('function');\n  });\n\n  it('should invoke beforeEach and afterEach', function () {\n    const stub = new Sandbox();\n\n    setupPolly({}, stub);\n    expect(stub.beforeEachCalled.size).to.equal(1);\n    expect(stub.afterEachCalled.size).to.equal(1);\n  });\n\n  it('should create a polly property and set recordingName', function () {\n    const stub = new Sandbox();\n\n    setupPolly({}, stub);\n    expect(stub.context.polly).to.be.a('object');\n    expect(stub.context.polly.recordingName).to.equal('mockname');\n  });\n\n  it('should concat title if test is deeply nested', function () {\n    const stub = new Sandbox({\n      currentTest: {\n        title: 'foo',\n        parent: {\n          title: 'bar',\n          parent: {\n            title: 'baz'\n          }\n        }\n      }\n    });\n\n    setupPolly({}, stub);\n    expect(stub.context.polly.recordingName).to.equal('baz/bar/foo');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/deferred-promise-test.js",
    "content": "import defer from '../../../src/utils/deferred-promise';\n\ndescribe('Unit | Utils | DeferredPromise', function () {\n  it('should exist', function () {\n    expect(defer).to.be.a('function');\n    expect(defer().resolve).to.be.a('function');\n    expect(defer().reject).to.be.a('function');\n  });\n\n  it('should resolve when calling .resolve()', async function () {\n    const promise = defer();\n\n    promise.resolve(42);\n    expect(await promise).to.equal(42);\n  });\n\n  it('should reject when calling .reject()', async function () {\n    const promise = defer();\n\n    promise.reject(new Error('42'));\n\n    try {\n      await promise;\n    } catch (error) {\n      expect(error).to.be.an('error');\n      expect(error.message).to.equal('42');\n    }\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/guid-for-recording-test.js",
    "content": "import guidForRecording from '../../../src/utils/guid-for-recording';\n\ndescribe('Unit | Utils | guidForRecording', function () {\n  it('should exist', function () {\n    expect(guidForRecording).to.be.a('function');\n  });\n\n  it('should remove illegal file system characters', function () {\n    expect(guidForRecording(`'?<>\\\\:*|\"`)).to.equal('_3218500777');\n  });\n\n  it('should create a guid for each segment of the name', function () {\n    const name = guidForRecording(`foo!/bar%/baz..`);\n\n    expect(name).to.equal('foo_2152783170/bar_567945773/baz_1682401886');\n  });\n\n  it('should trim name to 100 characters', function () {\n    const name = guidForRecording(new Array(200).fill('A').join(''));\n\n    expect(name.length).to.be.lte(100);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/http-headers-test.js",
    "content": "import HTTPHeaders from '../../../src/utils/http-headers';\n\nconst { keys } = Object;\n\ndescribe('Unit | Utils | HTTPHeaders', function () {\n  it('should exist', function () {\n    expect(HTTPHeaders).to.be.a('function');\n  });\n\n  it('should be instantiable', function () {\n    expect(new HTTPHeaders()).to.be.an('object');\n  });\n\n  it('can be constructed with defaults', function () {\n    expect(new HTTPHeaders({ A: 'a', b: 'b' })).to.deep.equal({\n      a: 'a',\n      b: 'b'\n    });\n  });\n\n  it('should lower-case keys', function () {\n    const headers = new HTTPHeaders();\n\n    headers['Content-Type'] = 'application/json';\n\n    expect(headers['content-type']).to.equal('application/json');\n    expect(headers['Content-Type']).to.equal('application/json');\n    expect(headers['CONTENT-TYPE']).to.equal('application/json');\n  });\n\n  it('should allow an empty header value', function () {\n    const headers = new HTTPHeaders();\n\n    headers['Content-Type'] = '';\n\n    expect(headers['Content-Type']).to.equal('');\n  });\n\n  it('should delete header regardless of case', function () {\n    const headers = new HTTPHeaders();\n\n    headers['Content-Type'] = 'application/json';\n    expect(keys(headers)).to.deep.equal(['content-type']);\n\n    delete headers['Content-Type'];\n    expect(keys(headers)).to.deep.equal([]);\n\n    headers['Content-Type'] = 'application/json';\n    expect(keys(headers)).to.deep.equal(['content-type']);\n\n    delete headers['CONTENT-TYPE'];\n    expect(keys(headers)).to.deep.equal([]);\n  });\n\n  it('should delete header when set with a null/undefined value', function () {\n    const headers = new HTTPHeaders();\n\n    headers['Content-Type'] = 'application/json';\n    expect(keys(headers)).to.deep.equal(['content-type']);\n\n    headers['Content-Type'] = null;\n    expect(keys(headers)).to.deep.equal([]);\n\n    headers['Content-Type'] = 'application/json';\n    expect(keys(headers)).to.deep.equal(['content-type']);\n\n    headers['Content-Type'] = undefined;\n    expect(keys(headers)).to.deep.equal([]);\n  });\n\n  it('should handle a non string getter', function () {\n    const headers = new HTTPHeaders();\n\n    expect(() => headers[Symbol()]).to.not.throw();\n  });\n\n  it('should not allow setting a non string header key', function () {\n    const headers = new HTTPHeaders();\n\n    expect(() => (headers[Symbol()] = 'Foo')).to.throw(TypeError);\n  });\n\n  it('should not allow deleting a non string header key', function () {\n    const headers = new HTTPHeaders();\n\n    expect(() => delete headers[Symbol()]).to.throw(TypeError);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/merge-configs-test.js",
    "content": "import mergeConfigs from '../../../src/utils/merge-configs';\n\ndescribe('Unit | Utils | mergeConfigs', function () {\n  it('should exist', function () {\n    expect(mergeConfigs).to.be.a('function');\n  });\n\n  it('should not deep merge context objects', async function () {\n    const context = {};\n    const config = mergeConfigs(\n      { fetch: {}, xhr: {} },\n      { fetch: { context } },\n      { xhr: { context } },\n      { fetch: {}, xhr: {} }\n    );\n\n    expect(config.fetch.context).to.equal(context);\n    expect(config.xhr.context).to.equal(context);\n  });\n\n  it('should not deep merge arrays', async function () {\n    const array = [{}];\n    const config = mergeConfigs({ array: [] }, { array });\n\n    expect(config.array).to.equal(array);\n    expect(config.array[0]).to.equal(array[0]);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/normalize-request-test.js",
    "content": "import {\n  body,\n  headers,\n  method,\n  url\n} from '../../../src/utils/normalize-request';\n\ndescribe('Unit | Utils | Normalize Request', function () {\n  it('should exist', function () {\n    expect(url).to.be.a('function');\n    expect(body).to.be.a('function');\n    expect(method).to.be.a('function');\n    expect(headers).to.be.a('function');\n  });\n\n  describe('method', function () {\n    it('should handle all verbs', function () {\n      expect(method('get')).to.equal('GET');\n      expect(method('put')).to.equal('PUT');\n      expect(method('post')).to.equal('POST');\n      expect(method('patch')).to.equal('PATCH');\n      expect(method('delete')).to.equal('DELETE');\n      expect(method('option')).to.equal('OPTION');\n    });\n\n    it('should support a custom fn', function () {\n      expect(method('GET', (m) => m.toLowerCase())).to.equal('get');\n    });\n\n    it('should pass the correct arguments to the custom fn', function () {\n      const req = {};\n\n      method(\n        'GET',\n        (method, request) => {\n          expect(method).to.equal('GET');\n          expect(request).to.equal(req);\n\n          return method;\n        },\n        req\n      );\n    });\n  });\n\n  describe('headers', function () {\n    it('should lower-case all header keys', function () {\n      expect(\n        headers({\n          Accept: 'foo',\n          'Content-Type': 'Bar'\n        })\n      ).to.deep.equal({\n        accept: 'foo',\n        'content-type': 'Bar'\n      });\n    });\n\n    it('should exclude specified headers', function () {\n      expect(\n        headers(\n          {\n            Accept: 'foo',\n            test: 'test',\n            'Content-Type': 'Bar'\n          },\n          { exclude: ['test', 'content-type'] }\n        )\n      ).to.deep.equal({ accept: 'foo' });\n    });\n\n    it('should support a custom fn', function () {\n      expect(\n        headers(\n          {\n            Accept: 'foo',\n            test: 'test',\n            'Content-Type': 'Bar'\n          },\n          (headers) => {\n            delete headers.test;\n\n            return headers;\n          }\n        )\n      ).to.deep.equal({ accept: 'foo', 'content-type': 'Bar' });\n    });\n\n    it('should pass the correct arguments to the custom fn', function () {\n      const req = {};\n      const reqHeaders = { foo: 'foo' };\n\n      headers(\n        reqHeaders,\n        (headers, request) => {\n          expect(headers).to.deep.equal(reqHeaders);\n          expect(request).to.equal(req);\n\n          return headers;\n        },\n        req\n      );\n    });\n\n    it('should not mutate the original headers in the custom fn', function () {\n      const reqHeaders = { foo: 'bar' };\n\n      expect(\n        headers(reqHeaders, (headers) => {\n          delete headers.foo;\n\n          return headers;\n        })\n      ).to.deep.equal({});\n\n      expect(reqHeaders).to.deep.equal({ foo: 'bar' });\n    });\n  });\n\n  describe('url', function () {\n    it('should sort query params', function () {\n      expect(url('http://foo.com/?b=1&c=1&a=1', {})).to.equal(\n        'http://foo.com/?a=1&b=1&c=1'\n      );\n    });\n\n    it('should respect `matchRequestsBy.url` config', function () {\n      [\n        [\n          /* config options */\n          'hash',\n          /* input url */\n          'http://hash-test.com/?b=1&c=1&a=1#hello=world',\n          /* expected when true */\n          [true, 'http://hash-test.com/?a=1&b=1&c=1#hello=world'],\n          /* expected when false */\n          [false, 'http://hash-test.com/?a=1&b=1&c=1'],\n          /* expected when custom fn */\n          [\n            (h) => h.replace('=', '!='),\n            'http://hash-test.com/?a=1&b=1&c=1#hello!=world'\n          ]\n        ],\n        [\n          'protocol',\n          'http://protocol-test.com/',\n          [true, 'http://protocol-test.com/'],\n          [false, '//protocol-test.com/'],\n          [(p) => p.replace('http', 'https'), 'https://protocol-test.com/']\n        ],\n        [\n          'query',\n          'http://query-test.com/?b=1&c=1&a=1',\n          [true, 'http://query-test.com/?a=1&b=1&c=1'],\n          [false, 'http://query-test.com/'],\n          [(q) => ({ ...q, c: 2 }), 'http://query-test.com/?a=1&b=1&c=2']\n        ],\n        [\n          'username',\n          'https://username:password@username-test.com/',\n          [true, 'https://username:password@username-test.com/'],\n          [false, 'https://username-test.com/'],\n          [(u) => `${u}123`, 'https://username123:password@username-test.com/']\n        ],\n        [\n          'password',\n          'https://username:password@password-test.com/',\n          [true, 'https://username:password@password-test.com/'],\n          [false, 'https://username@password-test.com/'],\n          [(p) => `${p}123`, 'https://username:password123@password-test.com/']\n        ],\n        [\n          'port',\n          'https://port-test.com:8000/',\n          [true, 'https://port-test.com:8000/'],\n          [false, 'https://port-test.com/'],\n          [(p) => Number(p) + 1, 'https://port-test.com:8001/']\n        ],\n        [\n          'pathname',\n          'https://pathname-test.com/bar/baz',\n          [true, 'https://pathname-test.com/bar/baz'],\n          [false, 'https://pathname-test.com'],\n          [(p) => p.replace('bar', 'foo'), 'https://pathname-test.com/foo/baz']\n        ]\n      ].forEach(([rule, input, ...options]) => {\n        options.forEach(([optionValue, expectedOutput]) => {\n          expect(url(input, { [rule]: optionValue })).to.equal(expectedOutput);\n        });\n      });\n    });\n\n    it('should respect relative urls', function () {\n      expect(url('/some/path')).to.equal('/some/path');\n    });\n\n    it('should support a custom fn', function () {\n      expect(\n        url('https://foo.bar/', (url) => url.replace('bar', 'foo'))\n      ).to.equal('https://foo.foo/');\n    });\n\n    it('should pass the correct arguments to the custom fn', function () {\n      const req = {};\n\n      url(\n        'https://foo.bar',\n        (url, request) => {\n          expect(url).to.deep.equal('https://foo.bar');\n          expect(request).to.equal(req);\n\n          return url;\n        },\n        req\n      );\n    });\n\n    it(\"should pass the correct arguments to the individual `matchRequestsBy.url` option's custom fn\", function () {\n      const req = {};\n\n      url(\n        'https://foo.bar',\n        {\n          protocol: (protocol, request) => {\n            expect(protocol).to.deep.equal('https:');\n            expect(request).to.equal(req);\n\n            return protocol;\n          }\n        },\n        req\n      );\n    });\n  });\n\n  describe('body', function () {\n    it('should support a custom fn', function () {\n      expect(body('foo', (b) => b.toUpperCase())).to.equal('FOO');\n    });\n\n    it('should pass the correct arguments to the custom fn', function () {\n      const req = {};\n\n      url(\n        'body',\n        (body, request) => {\n          expect(body).to.deep.equal('body');\n          expect(request).to.equal(req);\n\n          return body;\n        },\n        req\n      );\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/parse-url-test.js",
    "content": "import parseUrl from '../../../src/utils/parse-url';\n\ndescribe('Unit | Utils | parseUrl', function () {\n  it('should exist', function () {\n    expect(parseUrl).to.be.a('function');\n  });\n\n  it('should exactly match passed urls', function () {\n    [\n      '/movies/1',\n      'http://netflix.com/movies/1',\n      'http://netflix.com/movies/1?sort=title&dir=asc'\n    ].forEach((url) => expect(parseUrl(url).href).to.equal(url));\n  });\n\n  it('should passthrough arguments to url-parse', function () {\n    // Passing true tells url-parse to transform the querystring into an object\n    expect(parseUrl('/movies/1?sort=title&dir=asc', true).query).to.deep.equal({\n      sort: 'title',\n      dir: 'asc'\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/remove-host-from-url-test.js",
    "content": "import { URL } from '@pollyjs/utils';\n\nimport removeHost from '../../../src/utils/remove-host-from-url';\n\ndescribe('Unit | Utils | removeHostFromUrl', function () {\n  it('should exist', function () {\n    expect(removeHost).to.be.a('function');\n  });\n\n  it('should remove hostname', function () {\n    const url = removeHost(new URL('http://foo.com/bar/baz/'));\n\n    expect(url.toString()).to.equal('/bar/baz/');\n  });\n\n  it('should remove hostname without a tld', function () {\n    const url = removeHost(new URL('http://foo/bar/baz/'));\n\n    expect(url.toString()).to.equal('/bar/baz/');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/tests/unit/utils/timing-test.js",
    "content": "import Timing from '../../../src/utils/timing';\n\nfunction fixedTest(ms) {\n  it(`should handle ${ms}ms`, async function () {\n    // Fail the test if it exceeds ms + 10ms buffer\n    this.timeout(ms + 50);\n\n    const promise = Timing.fixed(ms)();\n    let resolved = false;\n\n    promise.then(() => (resolved = true));\n\n    if (ms) {\n      setTimeout(() => expect(resolved).to.be.false, ms / 2);\n    }\n    setTimeout(() => expect(resolved).to.be.true, ms + 1);\n\n    await promise;\n  });\n}\n\nfunction relativeTest(ratio) {\n  const timeout = ratio * 100;\n\n  it(`should handle a ratio of ${ratio}`, async function () {\n    // Fail the test if it exceeds timeout + 10ms buffer\n    this.timeout(timeout + 50);\n\n    const promise = Timing.relative(ratio)(100);\n    let resolved = false;\n\n    promise.then(() => (resolved = true));\n\n    if (timeout) {\n      setTimeout(() => expect(resolved).to.be.false, timeout / 2);\n    }\n    setTimeout(() => expect(resolved).to.be.true, timeout + 1);\n\n    await promise;\n  });\n}\n\ndescribe('Unit | Utils | Timing', function () {\n  it('should exist', function () {\n    expect(Timing).to.be.a('object');\n    expect(Timing.fixed).to.be.a('function');\n    expect(Timing.relative).to.be.a('function');\n  });\n\n  describe('fixed', function () {\n    fixedTest(0);\n    fixedTest(50);\n    fixedTest(100);\n  });\n\n  describe('relative', function () {\n    relativeTest(0);\n    relativeTest(0.5);\n    relativeTest(1.0);\n    relativeTest(2.0);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/core/types.d.ts",
    "content": "import Adapter from '@pollyjs/adapter';\nimport Persister from '@pollyjs/persister';\nimport { Logger, LogLevelDesc } from 'loglevel';\n\ntype Newable<T> = { new (...args: any[]): T };\n\nexport type MODE = 'record' | 'replay' | 'passthrough' | 'stopped';\nexport type ACTION = 'record' | 'replay' | 'intercept' | 'passthrough';\nexport type EXPIRY_STRATEGY = 'record' | 'warn' | 'error';\n\nexport const Timing: {\n  fixed(ms: number): () => Promise<void>;\n  relative(ratio: number): (ms: number) => Promise<void>;\n};\n\nexport type MatchBy<T = string, R = T> = (input: T, req: Request) => R;\nexport type Headers = Record<string, string | string[]>;\nexport interface PollyConfig {\n  mode?: MODE | undefined;\n\n  adapters?: Array<string | Newable<Adapter>> | undefined;\n  adapterOptions?:\n    | {\n        fetch?: { context?: any } | undefined;\n        puppeteer?:\n          | { page?: any; requestResourceTypes?: string[] | undefined }\n          | undefined;\n        xhr?: { context?: any } | undefined;\n        [key: string]: any;\n      }\n    | undefined;\n\n  persister?: string | Newable<Persister> | undefined;\n  persisterOptions?:\n    | {\n        keepUnusedRequests?: boolean | undefined;\n        disableSortingHarEntries?: boolean | undefined;\n        fs?: { recordingsDir?: string | undefined } | undefined;\n        'local-storage'?:\n          | { context?: any; key?: string | undefined }\n          | undefined;\n        rest?:\n          | { host?: string | undefined; apiNamespace?: string | undefined }\n          | undefined;\n        [key: string]: any;\n      }\n    | undefined;\n\n  logLevel?: LogLevelDesc | undefined;\n  flushRequestsOnStop?: boolean | undefined;\n\n  recordIfMissing?: boolean | undefined;\n  recordFailedRequests?: boolean | undefined;\n  expiryStrategy?: EXPIRY_STRATEGY | undefined;\n\n  expiresIn?: string | null | undefined;\n  timing?: ((ms: number) => Promise<void>) | (() => Promise<void>) | undefined;\n\n  matchRequestsBy?:\n    | {\n        method?: boolean | MatchBy | undefined;\n        headers?:\n          | boolean\n          | { exclude: string[] }\n          | MatchBy<Headers>\n          | undefined;\n        body?: boolean | MatchBy<any> | undefined;\n        order?: boolean | undefined;\n\n        url?:\n          | boolean\n          | MatchBy\n          | {\n              protocol?: boolean | MatchBy | undefined;\n              username?: boolean | MatchBy | undefined;\n              password?: boolean | MatchBy | undefined;\n              hostname?: boolean | MatchBy | undefined;\n              port?: boolean | MatchBy<number> | undefined;\n              pathname?: boolean | MatchBy | undefined;\n              query?: boolean | MatchBy<{ [key: string]: any }> | undefined;\n              hash?: boolean | MatchBy | undefined;\n            }\n          | undefined;\n      }\n    | undefined;\n}\nexport interface HTTPBase {\n  headers: Headers;\n  body?: string;\n\n  getHeader(name: string): string | string[] | null;\n  setHeader(name: string, value?: string | string[] | null): this;\n  setHeaders(headers: Headers): this;\n  removeHeader(name: string): this;\n  removeHeaders(headers: string[]): this;\n  hasHeader(name: string): boolean;\n  type(contentType: string): this;\n  send(body: any): this;\n  json(body: any): this;\n  jsonBody(): any;\n}\n\nexport type RequestEvent = 'identify';\nexport type RequestArguments = { [key: string]: any };\n\nexport interface Request<TArguments extends RequestArguments = {}>\n  extends HTTPBase {\n  method: string;\n  url: string;\n  readonly absoluteUrl: string;\n  readonly protocol: string;\n  readonly hostname: string;\n  readonly port: string;\n  readonly pathname: string;\n  hash: string;\n  query: { [key: string]: string | string[] };\n  readonly params: { [key: string]: string };\n  readonly log: Logger;\n  readonly requestArguments: TArguments;\n  recordingName: string;\n  recordingId: string;\n  responseTime?: number | undefined;\n  timestamp?: string | undefined;\n  didRespond: boolean;\n  id?: string | undefined;\n  order?: number | undefined;\n  action: ACTION | null;\n  aborted: boolean;\n  promise: Promise<void>;\n  response?: Response;\n  configure(config: Partial<PollyConfig>): void;\n  overrideRecordingName(recordingName: string): void;\n  on(event: RequestEvent, listener: RequestEventListener): this;\n  once(event: RequestEvent, listener: RequestEventListener): this;\n  off(event: RequestEvent, listener?: RequestEventListener): this;\n}\nexport interface Response extends HTTPBase {\n  statusCode: number;\n  encoding: string | undefined;\n  readonly statusText: string;\n  readonly ok: boolean;\n\n  status(status: number): this;\n  sendStatus(status: number): this;\n  end(): Readonly<this>;\n}\n\nexport type RequestRouteEvent = 'request';\nexport type RecordingRouteEvent = 'beforeReplay' | 'beforePersist';\nexport type ResponseRouteEvent = 'beforeResponse' | 'response';\nexport type ErrorRouteEvent = 'error';\nexport type AbortRouteEvent = 'abort';\n\nexport interface ListenerEvent {\n  readonly type: string;\n  stopPropagation: () => void;\n}\nexport interface Interceptor extends ListenerEvent {\n  abort(): void;\n  passthrough(): void;\n}\nexport type ErrorEventListener = (\n  req: Request,\n  error: any,\n  event: ListenerEvent\n) => void | Promise<void>;\nexport type AbortEventListener = (\n  req: Request,\n  event: ListenerEvent\n) => void | Promise<void>;\nexport type RequestEventListener = (\n  req: Request,\n  event: ListenerEvent\n) => void | Promise<void>;\nexport type RecordingEventListener = (\n  req: Request,\n  recording: any,\n  event: ListenerEvent\n) => void | Promise<void>;\nexport type ResponseEventListener = (\n  req: Request,\n  res: Response,\n  event: ListenerEvent\n) => void | Promise<void>;\nexport type InterceptHandler = (\n  req: Request,\n  res: Response,\n  interceptor: Interceptor\n) => void | Promise<void>;\nexport class RouteHandler {\n  on(event: RequestRouteEvent, listener: RequestEventListener): RouteHandler;\n  on(\n    event: RecordingRouteEvent,\n    listener: RecordingEventListener\n  ): RouteHandler;\n  on(event: ResponseRouteEvent, listener: ResponseEventListener): RouteHandler;\n  on(event: ErrorRouteEvent, listener: ErrorEventListener): RouteHandler;\n  on(event: AbortRouteEvent, listener: AbortEventListener): RouteHandler;\n  off(event: RequestRouteEvent, listener?: RequestEventListener): RouteHandler;\n  off(\n    event: RecordingRouteEvent,\n    listener?: RecordingEventListener\n  ): RouteHandler;\n  off(\n    event: ResponseRouteEvent,\n    listener?: ResponseEventListener\n  ): RouteHandler;\n  off(event: ErrorRouteEvent, listener?: ErrorEventListener): RouteHandler;\n  off(event: AbortRouteEvent, listener?: AbortEventListener): RouteHandler;\n  once(event: RequestRouteEvent, listener: RequestEventListener): RouteHandler;\n  once(\n    event: RecordingRouteEvent,\n    listener: RecordingEventListener\n  ): RouteHandler;\n  once(\n    event: ResponseRouteEvent,\n    listener: ResponseEventListener\n  ): RouteHandler;\n  once(event: ErrorRouteEvent, listener: ErrorEventListener): RouteHandler;\n  once(event: AbortRouteEvent, listener: AbortEventListener): RouteHandler;\n  filter: (callback: (req: Request) => boolean) => RouteHandler;\n  passthrough(value?: boolean): RouteHandler;\n  intercept(fn: InterceptHandler): RouteHandler;\n  recordingName(recordingName?: string): RouteHandler;\n  configure(config: Partial<PollyConfig>): RouteHandler;\n  times(n?: number): RouteHandler;\n}\nexport class PollyServer {\n  timeout(ms: number): Promise<void>;\n  get(routes?: string | string[]): RouteHandler;\n  put(routes?: string | string[]): RouteHandler;\n  post(routes?: string | string[]): RouteHandler;\n  delete(routes?: string | string[]): RouteHandler;\n  patch(routes?: string | string[]): RouteHandler;\n  head(routes?: string | string[]): RouteHandler;\n  options(routes?: string | string[]): RouteHandler;\n  merge(routes?: string | string[]): RouteHandler;\n  any(routes?: string | string[]): RouteHandler;\n  host(host: string, callback: () => void): void;\n  namespace(path: string, callback: () => void): void;\n}\nexport class PollyLogger {\n  polly: Polly;\n  log: Logger;\n  connect(): void;\n  disconnect(): void;\n  logRequest(request: Request): void;\n  logRequestResponse(request: Request, response: Response): void;\n  logRequestError(request: Request, error: Error): void;\n}\nexport type PollyEvent = 'create' | 'stop' | 'register';\nexport type PollyEventListener = (poll: Polly) => void;\nexport class Polly {\n  static register<T extends Adapter | Persister>(Factory: Newable<T>): void;\n  static unregister<T extends Adapter | Persister>(Factory: Newable<T>): void;\n  static on(event: PollyEvent, listener: PollyEventListener): void;\n  static off(event: PollyEvent, listener: PollyEventListener): void;\n  static once(event: PollyEvent, listener: PollyEventListener): void;\n\n  constructor(recordingName: string, options?: PollyConfig);\n\n  static VERSION: string;\n  recordingName: string;\n  recordingId: string;\n  mode: MODE;\n  server: PollyServer;\n  persister: Persister | null;\n  adapters: Map<string, Adapter>;\n  config: PollyConfig;\n  logger: PollyLogger;\n\n  private _requests: Request[];\n\n  pause(): void;\n  play(): void;\n  replay(): void;\n  record(): void;\n  passthrough(): void;\n  stop(): Promise<void>;\n  flush(): Promise<void>;\n  configure(config: Partial<PollyConfig>): void;\n  connectTo(name: string | typeof Adapter): void;\n  disconnectFrom(name: string | typeof Adapter): void;\n  disconnect(): void;\n}\n\nexport const setupMocha: {\n  (config?: PollyConfig, context?: any): void;\n  beforeEach: (config?: PollyConfig, context?: any) => void;\n  afterEach: (context?: any) => void;\n};\n\nexport const setupQunit: {\n  (hooks: any, config?: PollyConfig): void;\n  beforeEach: (hooks: any, config?: PollyConfig) => void;\n  afterEach: (hooks: any) => void;\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/.editorconfig",
    "content": "# EditorConfig helps developers define and maintain consistent\n# coding styles between different editors and IDEs\n# editorconfig.org\n\nroot = true\n\n[*]\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\n\n[*.hbs]\ninsert_final_newline = false\n\n[*.{diff,md}]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "packages/@pollyjs/ember/.ember-cli",
    "content": "{\n  /**\n    Ember CLI sends analytics information by default. The data is completely\n    anonymous, but there are times when you might want to disable this behavior.\n\n    Setting `disableAnalytics` to true will prevent any data from being sent.\n  */\n  \"disableAnalytics\": false\n}\n"
  },
  {
    "path": "packages/@pollyjs/ember/.eslintignore",
    "content": "# unconventional js\n/blueprints/*/files/\n/vendor/\n\n# compiled output\n/dist/\n/tmp/\n\n# dependencies\n/bower_components/\n/node_modules/\n\n# misc\n/coverage/\n!.*\n.*/\n.eslintcache\n\n# ember-try\n/.node_modules.ember-try/\n/bower.json.ember-try\n/package.json.ember-try\n"
  },
  {
    "path": "packages/@pollyjs/ember/.eslintrc.js",
    "content": "'use strict';\n\nmodule.exports = {\n  root: true,\n  parser: '@babel/eslint-parser',\n  parserOptions: {\n    ecmaVersion: 2018,\n    sourceType: 'module',\n    requireConfigFile: false,\n    ecmaFeatures: {\n      legacyDecorators: true\n    }\n  },\n  plugins: ['ember'],\n  extends: [\n    'eslint:recommended',\n    'plugin:ember/recommended',\n    'plugin:prettier/recommended'\n  ],\n  env: {\n    browser: true,\n    node: true\n  },\n  rules: {},\n  overrides: [\n    // node files\n    {\n      files: [\n        './.eslintrc.js',\n        './.prettierrc.js',\n        './.template-lintrc.js',\n        './ember-cli-build.js',\n        './index.js',\n        './testem.js',\n        './blueprints/*/index.js',\n        './config/**/*.js',\n        './tests/dummy/config/**/*.js'\n      ],\n      parserOptions: {\n        sourceType: 'script'\n      },\n      env: {\n        browser: false,\n        node: true\n      },\n      plugins: ['node'],\n      extends: ['plugin:node/recommended']\n    },\n    {\n      // Test files:\n      files: ['tests/**/*-test.{js,ts}'],\n      extends: ['plugin:qunit/recommended']\n    }\n  ]\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/.gitignore",
    "content": "# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# compiled output\n/dist/\n/tmp/\n\n# dependencies\n/bower_components/\n/node_modules/\n\n# misc\n/.env*\n/.pnp*\n/.sass-cache\n/.eslintcache\n/connect.lock\n/coverage/\n/libpeerconnection.log\n/npm-debug.log*\n/testem.log\n/yarn-error.log\n\n# ember-try\n/.node_modules.ember-try/\n/bower.json.ember-try\n/package.json.ember-try\n"
  },
  {
    "path": "packages/@pollyjs/ember/.npmignore",
    "content": "# compiled output\n/dist/\n/tmp/\n\n# dependencies\n/bower_components/\n\n# misc\n/.bowerrc\n/.editorconfig\n/.ember-cli\n/.env*\n/.eslintcache\n/.eslintignore\n/.eslintrc.js\n/.git/\n/.gitignore\n/.prettierignore\n/.prettierrc.js\n/.template-lintrc.js\n/.travis.yml\n/.watchmanconfig\n/bower.json\n/config/ember-try.js\n/CONTRIBUTING.md\n/ember-cli-build.js\n/testem.js\n/tests/\n/yarn-error.log\n/yarn.lock\n.gitkeep\n\n# ember-try\n/.node_modules.ember-try/\n/bower.json.ember-try\n/package.json.ember-try\n"
  },
  {
    "path": "packages/@pollyjs/ember/.prettierignore",
    "content": "# unconventional js\n/blueprints/*/files/\n/vendor/\n\n# compiled output\n/dist/\n/tmp/\n\n# dependencies\n/bower_components/\n/node_modules/\n\n# misc\n/coverage/\n!.*\n.eslintcache\n\n# ember-try\n/.node_modules.ember-try/\n/bower.json.ember-try\n/package.json.ember-try\n"
  },
  {
    "path": "packages/@pollyjs/ember/.prettierrc.js",
    "content": "'use strict';\n\nmodule.exports = {\n  singleQuote: true,\n  trailingComma: 'none'\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/.template-lintrc.js",
    "content": "'use strict';\n\nmodule.exports = {\n  extends: 'recommended',\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/.watchmanconfig",
    "content": "{\n  \"ignore_dirs\": [\"tmp\", \"dist\", \"tests/recordings\"]\n}\n"
  },
  {
    "path": "packages/@pollyjs/ember/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **ember:** Bump peer dependencies to 6.x ([#432](https://github.com/netflix/pollyjs/issues/432)) ([1529226](https://github.com/netflix/pollyjs/commit/152922688744c8a2f8d89f793dcecf3c2bc40033))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n# [5.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v5.1.1...v5.2.0) (2021-11-24)\n\n\n### Features\n\n* **ember:** Upgrade ember-cli-babel to ^7.26.6 ([#411](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/issues/411)) ([4352881](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/4352881))\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [5.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v5.0.2...v5.1.0) (2020-12-12)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [5.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v5.0.0...v5.0.1) (2020-09-25)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [4.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v4.0.0...v4.0.1) (2020-01-25)\n\n\n### Bug Fixes\n\n* **ember:** Config read from project root ([7d6da38](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/7d6da38))\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n\n### chore\n\n* Drop node 8 support ([#292](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/issues/292)) ([4448be5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/4448be5))\n\n\n### BREAKING CHANGES\n\n* Drop support for Node 8 as it is now EOL\n\n\n\n\n\n## [3.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v3.0.0...v3.0.1) (2019-12-25)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n\n### Bug Fixes\n\n* **ember:** loads polly config for ember by its own module ([#277](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/issues/277)) ([0569040](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0569040))\n\n\n### BREAKING CHANGES\n\n* **ember:** moves location of polly configuration\n\n\n\n\n\n# [2.7.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.6.3...v2.7.0) (2019-11-21)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.5.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.4.0...v2.5.0) (2019-06-06)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.3.2...v2.4.0) (2019-04-27)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [2.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.3.0...v2.3.1) (2019-03-06)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.2.0...v2.3.0) (2019-02-27)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.1.0...v2.2.0) (2019-02-20)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Bug Fixes\n\n* **ember:** Remove Node 6 from supported versions ([#169](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/169)) ([07b2b4e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/07b2b4e))\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/ember\n\n\n\n\n\n      <a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Bumping core within Ember ([af4faa1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/af4faa1))\n* Ensure polly's middleware goes before ember-cli's ([#36](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/36)) ([43db361](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/43db361))\n* **core:** Set `url` on the fetch Response object ([#44](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/44)) ([f5980cf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/f5980cf)), closes [#43](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/issues/43)\n* **ember:** Fix auto-register and add tests to cover ([24c15bd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/24c15bd))\n\n\n### Features\n\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0a3d591))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/8bb313c))\n* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/164dbac))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/29ed8e1))\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/d4be431))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0b47838))\n\n\n### BREAKING CHANGES\n\n* __Adapters__\n\n```js\nimport { XHRAdapter, FetchAdapter } from '@pollyjs/core';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\nadapters: ['xhr', FetchAdapter]\n});\n```\n\n__Persister__\n\n```js\nimport { LocalStoragePersister, RESTPersister } from '@pollyjs/core';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\npersister: 'local-storage'\n});\n\npolly.configure({\npersister: RESTPersister\n});\n```\n\n\n\n\n      <a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@1.0.4...@pollyjs/ember@1.0.5) (2018-08-22)\n\n\n### Bug Fixes\n\n* **ember:** Fix auto-register and add tests to cover ([24c15bd](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/24c15bd))\n\n\n\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@1.0.3...@pollyjs/ember@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@1.0.2...@pollyjs/ember@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@1.0.1...@pollyjs/ember@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@1.0.0...@pollyjs/ember@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.4.2...@pollyjs/ember@1.0.0) (2018-07-20)\n\n\n### Features\n\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0a3d591))\n* Improved adapter and persister registration ([#62](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/62)) ([164dbac](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/164dbac))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/0b47838))\n\n\n### BREAKING CHANGES\n\n* __Adapters__\n\n```js\nimport { XHRAdapter, FetchAdapter } from '@pollyjs/core';\n\n// Register the xhr adapter so its accessible by all future polly instances\nPolly.register(XHRAdapter);\n\npolly.configure({\nadapters: ['xhr', FetchAdapter]\n});\n```\n\n__Persister__\n\n```js\nimport { LocalStoragePersister, RESTPersister } from '@pollyjs/core';\n\n// Register the local-storage persister so its accessible by all future polly instances\nPolly.register(LocalStoragePersister);\n\npolly.configure({\npersister: 'local-storage'\n});\n\npolly.configure({\npersister: RESTPersister\n});\n```\n\n\n\n\n<a name=\"0.4.2\"></a>\n## [0.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.4.1...@pollyjs/ember@0.4.2) (2018-06-29)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"0.4.1\"></a>\n## [0.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.4.0...@pollyjs/ember@0.4.1) (2018-06-27)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"0.4.0\"></a>\n# [0.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.3.1...@pollyjs/ember@0.4.0) (2018-06-27)\n\n\n### Bug Fixes\n\n* **core:** Set `url` on the fetch Response object ([#44](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/44)) ([f5980cf](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/f5980cf)), closes [#43](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/issues/43)\n\n\n### Features\n\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/d4be431))\n\n\n\n\n<a name=\"0.3.1\"></a>\n## [0.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.3.0...@pollyjs/ember@0.3.1) (2018-06-22)\n\n\n### Bug Fixes\n\n* Bumping core within Ember ([af4faa1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/af4faa1))\n\n\n\n\n<a name=\"0.3.0\"></a>\n# [0.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.2.1...@pollyjs/ember@0.3.0) (2018-06-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/ember\n\n<a name=\"0.2.1\"></a>\n## [0.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.2.0...@pollyjs/ember@0.2.1) (2018-06-21)\n\n\n### Bug Fixes\n\n* Ensure polly's middleware goes before ember-cli's ([#36](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/ember/issues/36)) ([43db361](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/43db361))\n\n\n\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/compare/@pollyjs/ember@0.1.0...@pollyjs/ember@0.2.0) (2018-06-16)\n\n\n### Features\n\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember/commit/8bb313c))\n"
  },
  {
    "path": "packages/@pollyjs/ember/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/ember/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fember.svg)](https://badge.fury.io/js/%40pollyjs%2Fember)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nInstalling the `@pollyjs/ember` addon will import and vendor the necessary\nPolly.JS packages as well as register the [Express API](https://netflix.github.io/pollyjs/#/node-server/express-integrations)\nrequired by the [REST Persister](https://netflix.github.io/pollyjs/#/persisters/rest).\n\n## Installation\n\n```bash\nember install @pollyjs/ember\n```\n\n## Documentation\n\nCheck out the [Ember CLI Addon](https://netflix.github.io/pollyjs/#/frameworks/ember-cli)\ndocumentation for more details.\n\n## Configuration\n\nAddon and [server API configuration](https://netflix.github.io/pollyjs/#/node-server/overview#api-configuration) can be specified in `<app root>/config/polly.js`. The default configuration options are shown below.\n\n```js\nmodule.exports = function(env) {\n  return {\n    // Addon Configuration Options\n    enabled: env !== 'production',\n\n    // Server Configuration Options\n    server: {\n      apiNamespace: '/polly',\n      recordingsDir: 'recordings'\n    }\n  };\n};\n```\n\n## Usage\n\nOnce installed and configured, you can import and use Polly as documented. Check\nout the [Quick Start](https://netflix.github.io/pollyjs/#/quick-start#usage) documentation to get started.\n\n> For an even better testing experience, check out the provided [QUnit Test Helper](https://netflix.github.io/pollyjs/#/test-frameworks/qunit)!\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/ember/addon/-private/preconfigure.js",
    "content": "import { Polly } from '@pollyjs/core';\nimport XHRAdapter from '@pollyjs/adapter-xhr';\nimport FetchAdapter from '@pollyjs/adapter-fetch';\nimport RESTPersister from '@pollyjs/persister-rest';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\nPolly.register(XHRAdapter);\nPolly.register(FetchAdapter);\nPolly.register(RESTPersister);\nPolly.register(LocalStoragePersister);\n\nPolly.on('create', (polly) => {\n  polly.configure({\n    adapters: ['xhr', 'fetch'],\n    persister: 'rest',\n    /**\n     * @pollyjs/ember mounts the express middleware onto to the running\n     * testem and ember-cli express server and a relative host (an empty `host`)\n     * is preferred here. Can be overridden at runtime in cases where the\n     * Polly server is externally hosted.\n     */\n    persisterOptions: { rest: { host: '' } }\n  });\n});\n\nexport default Polly;\n"
  },
  {
    "path": "packages/@pollyjs/ember/blueprints/@pollyjs/ember/files/config/polly.js",
    "content": "/* eslint-env node */\n\n'use strict';\n\nmodule.exports = function (env) {\n  return {\n    enabled: env !== 'production',\n    server: {\n      apiNamespace: '/polly',\n      recordingsDir: 'recordings'\n    }\n  };\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/blueprints/@pollyjs/ember/index.js",
    "content": "'use strict';\n\nmodule.exports = {\n  description: 'Setup @pollyjs/ember',\n  normalizeEntityName() {},\n  afterInstall() {\n    return this.addPackagesToProject([\n      { name: '@pollyjs/adapter-fetch' },\n      { name: '@pollyjs/adapter-xhr' },\n      { name: '@pollyjs/core' },\n      { name: '@pollyjs/node-server' },\n      { name: '@pollyjs/persister-local-storage' },\n      { name: '@pollyjs/persister-rest' }\n    ]);\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/config/ember-try.js",
    "content": "'use strict';\n\nconst getChannelURL = require('ember-source-channel-url');\nconst { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');\n\nmodule.exports = async function () {\n  return {\n    scenarios: [\n      {\n        name: 'ember-lts-3.20',\n        npm: {\n          devDependencies: {\n            'ember-source': '~3.20.5'\n          }\n        }\n      },\n      {\n        name: 'ember-lts-3.24',\n        npm: {\n          devDependencies: {\n            'ember-source': '~3.24.3'\n          }\n        }\n      },\n      {\n        name: 'ember-release',\n        npm: {\n          devDependencies: {\n            'ember-source': await getChannelURL('release')\n          }\n        }\n      },\n      {\n        name: 'ember-beta',\n        npm: {\n          devDependencies: {\n            'ember-source': await getChannelURL('beta')\n          }\n        }\n      },\n      {\n        name: 'ember-canary',\n        npm: {\n          devDependencies: {\n            'ember-source': await getChannelURL('canary')\n          }\n        }\n      },\n      {\n        name: 'ember-default-with-jquery',\n        env: {\n          EMBER_OPTIONAL_FEATURES: JSON.stringify({\n            'jquery-integration': true\n          })\n        },\n        npm: {\n          devDependencies: {\n            '@ember/jquery': '^1.1.0'\n          }\n        }\n      },\n      {\n        name: 'ember-classic',\n        env: {\n          EMBER_OPTIONAL_FEATURES: JSON.stringify({\n            'application-template-wrapper': true,\n            'default-async-observers': false,\n            'template-only-glimmer-components': false\n          })\n        },\n        npm: {\n          devDependencies: {\n            'ember-source': '~3.28.0'\n          },\n          ember: {\n            edition: 'classic'\n          }\n        }\n      },\n      embroiderSafe(),\n      embroiderOptimized()\n    ]\n  };\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/config/environment.js",
    "content": "'use strict';\n\nmodule.exports = function () {\n  return {};\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/config/polly.js",
    "content": "/* eslint-env node */\n\n'use strict';\n\nmodule.exports = function (env) {\n  // See: https://netflix.github.io/pollyjs/#/frameworks/ember-cli?id=configuration\n  return {\n    enabled: env !== 'production',\n    server: {\n      apiNamespace: '/polly',\n      recordingsDir: 'recordings'\n    }\n  };\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/ember-cli-build.js",
    "content": "'use strict';\n\nconst EmberAddon = require('ember-cli/lib/broccoli/ember-addon');\n\nmodule.exports = function (defaults) {\n  let app = new EmberAddon(defaults, {\n    // Add options here\n  });\n\n  /*\n    This build file specifies the options for the dummy test app of this\n    addon, located in `/tests/dummy`\n    This build file does *not* influence how the addon or the app using it\n    behave. You most likely want to be modifying `./index.js` or app's build file\n  */\n\n  const { maybeEmbroider } = require('@embroider/test-setup');\n  return maybeEmbroider(app, {\n    skipBabel: [\n      {\n        package: 'qunit'\n      }\n    ]\n  });\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/index.js",
    "content": "/* eslint-env node */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst { registerExpressAPI, Defaults } = require('@pollyjs/node-server');\nconst parseArgs = require('minimist');\n\nconst root = process.cwd();\n\nfunction determineEnv() {\n  if (process.env.EMBER_ENV) {\n    return process.env.EMBER_ENV;\n  }\n\n  let args = parseArgs(process.argv);\n  let env = args.e || args.env || args.environment;\n\n  // Is it \"ember b -prod\" or \"ember build --prod\" command?\n  if (\n    !env &&\n    (process.argv.indexOf('-prod') > -1 || process.argv.indexOf('--prod') > -1)\n  ) {\n    env = 'production';\n  }\n\n  // Is it \"ember test\" or \"ember t\" command without explicit env specified?\n  if (\n    !env &&\n    (process.argv.indexOf('test') > -1 || process.argv.indexOf('t') > -1)\n  ) {\n    env = 'test';\n  }\n\n  return env || 'development';\n}\n\nmodule.exports = {\n  name: require('./package').name,\n  _config: null,\n\n  init() {\n    // see: https://github.com/ember-cli/ember-cli/blob/725e129e62bccbf21af55b21180edb8966781f53/lib/models/addon.js#L258\n    this._super.init && this._super.init.apply(this, arguments);\n\n    const env = determineEnv();\n\n    this._config = this._pollyConfig(env);\n  },\n\n  treeForAddon() {\n    if (!this._config.enabled) {\n      return;\n    }\n\n    return this._super.treeForAddon.apply(this, arguments);\n  },\n\n  contentFor(name) {\n    if (name !== 'app-prefix' || !this._config.enabled) {\n      return;\n    }\n\n    return `\n      (function() {\n        'use strict';\n        require('@pollyjs/ember/-private/preconfigure');\n      })();\n    `;\n  },\n\n  _pollyConfig(env) {\n    // defaults\n    const config = {\n      enabled: env !== 'production',\n      server: {}\n    };\n\n    // NOTE: this is because we cannot assume `this.project` is always set.\n    // If unavailable, we default to process.cwd (root) to determine the project root.\n    // See: https://github.com/Netflix/pollyjs/issues/276\n    const projectRoot =\n      this.project && this.project.root ? this.project.root : root;\n    const configPath = path.join(projectRoot, 'config', 'polly.js');\n\n    if (fs.existsSync(configPath)) {\n      const configGenerator = require(configPath);\n\n      Object.assign(config, configGenerator(env));\n    }\n\n    config.server.recordingsDir = path.join(\n      projectRoot,\n      config.server.recordingsDir || Defaults.recordingsDir\n    );\n\n    return config;\n  },\n\n  serverMiddleware(startOptions) {\n    this.testemMiddleware(startOptions.app);\n  },\n\n  testemMiddleware(app) {\n    if (this._config.enabled) {\n      registerExpressAPI(app, this._config.server);\n    }\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/package.json",
    "content": "{\n  \"name\": \"@pollyjs/ember\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Use @pollyjs in your Ember-CLI application\",\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"test\",\n    \"ember-addon\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/ember\",\n  \"license\": \"Apache-2.0\",\n  \"directories\": {\n    \"doc\": \"doc\",\n    \"test\": \"tests\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"ember build\",\n    \"start\": \"ember serve\",\n    \"test\": \"ember test ci --test-port=7300\",\n    \"clean\": \"rimraf dist tmp\"\n  },\n  \"dependencies\": {\n    \"ember-auto-import\": \"^2.2.4\",\n    \"ember-cli-babel\": \"^7.26.6\",\n    \"minimist\": \"^1.2.5\"\n  },\n  \"peerDependencies\": {\n    \"@pollyjs/adapter-fetch\": \"^6.0.0\",\n    \"@pollyjs/adapter-xhr\": \"^6.0.0\",\n    \"@pollyjs/core\": \"^6.0.0\",\n    \"@pollyjs/node-server\": \"^6.0.0\",\n    \"@pollyjs/persister-local-storage\": \"^6.0.0\",\n    \"@pollyjs/persister-rest\": \"^6.0.0\"\n  },\n  \"devDependencies\": {\n    \"@babel/eslint-parser\": \"^7.16.3\",\n    \"@ember/optional-features\": \"^2.0.0\",\n    \"@ember/test-helpers\": \"^2.4.2\",\n    \"@embroider/test-setup\": \"^0.43.5\",\n    \"@glimmer/component\": \"^1.0.4\",\n    \"@glimmer/tracking\": \"^1.0.4\",\n    \"broccoli-asset-rev\": \"^3.0.0\",\n    \"ember-cli\": \"~3.28.4\",\n    \"ember-cli-dependency-checker\": \"^3.2.0\",\n    \"ember-cli-htmlbars\": \"^5.7.1\",\n    \"ember-cli-inject-live-reload\": \"^2.1.0\",\n    \"ember-cli-sri\": \"^2.1.1\",\n    \"ember-cli-terser\": \"^4.0.2\",\n    \"ember-disable-prototype-extensions\": \"^1.1.3\",\n    \"ember-export-application-global\": \"^2.0.1\",\n    \"ember-load-initializers\": \"^2.1.2\",\n    \"ember-maybe-import-regenerator\": \"^0.1.6\",\n    \"ember-page-title\": \"^6.2.2\",\n    \"ember-qunit\": \"^5.1.4\",\n    \"ember-resolver\": \"^8.0.2\",\n    \"ember-source\": \"~3.28.0\",\n    \"ember-source-channel-url\": \"^3.0.0\",\n    \"ember-template-lint\": \"^3.6.0\",\n    \"ember-try\": \"^1.4.0\",\n    \"eslint\": \"^8.3.0\",\n    \"eslint-config-prettier\": \"^8.3.0\",\n    \"eslint-plugin-ember\": \"^10.5.8\",\n    \"eslint-plugin-node\": \"^11.1.0\",\n    \"eslint-plugin-prettier\": \"^4.0.0\",\n    \"eslint-plugin-qunit\": \"^7.1.0\",\n    \"loader.js\": \"^4.7.0\",\n    \"npm-run-all\": \"^4.1.5\",\n    \"prettier\": \"^2.5.0\",\n    \"qunit\": \"^2.16.0\",\n    \"qunit-dom\": \"^1.6.0\",\n    \"rimraf\": \"^2.6.2\",\n    \"webpack\": \"^5.64.4\"\n  },\n  \"engines\": {\n    \"node\": \"12.* || 14.* || >= 16\"\n  },\n  \"ember\": {\n    \"edition\": \"octane\"\n  },\n  \"ember-addon\": {\n    \"configPath\": \"tests/dummy/config\",\n    \"before\": [\n      \"proxy-server-middleware\"\n    ],\n    \"after\": [\n      \"ember-auto-import\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/ember/testem.js",
    "content": "'use strict';\n\nmodule.exports = {\n  test_page: 'tests/index.html?hidepassed',\n  disable_watching: true,\n  launch_in_ci: ['Chrome'],\n  launch_in_dev: ['Chrome'],\n  browser_start_timeout: 120,\n  browser_args: {\n    Chrome: {\n      ci: [\n        // --no-sandbox is needed when running Chrome inside a container\n        process.env.CI ? '--no-sandbox' : null,\n        '--headless',\n        '--disable-dev-shm-usage',\n        '--disable-software-rasterizer',\n        '--mute-audio',\n        '--remote-debugging-port=0',\n        '--window-size=1440,900'\n      ].filter(Boolean)\n    }\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/app.js",
    "content": "import Application from '@ember/application';\nimport Resolver from 'ember-resolver';\nimport loadInitializers from 'ember-load-initializers';\nimport config from 'dummy/config/environment';\n\nexport default class App extends Application {\n  modulePrefix = config.modulePrefix;\n  podModulePrefix = config.podModulePrefix;\n  Resolver = Resolver;\n}\n\nloadInitializers(App, config.modulePrefix);\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/components/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/controllers/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/helpers/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <title>Dummy</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n    {{content-for \"head\"}}\n\n    <link integrity=\"\" rel=\"stylesheet\" href=\"{{rootURL}}assets/vendor.css\">\n    <link integrity=\"\" rel=\"stylesheet\" href=\"{{rootURL}}assets/dummy.css\">\n\n    {{content-for \"head-footer\"}}\n  </head>\n  <body>\n    {{content-for \"body\"}}\n\n    <script src=\"{{rootURL}}assets/vendor.js\"></script>\n    <script src=\"{{rootURL}}assets/dummy.js\"></script>\n\n    {{content-for \"body-footer\"}}\n  </body>\n</html>\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/models/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/router.js",
    "content": "import EmberRouter from '@ember/routing/router';\nimport config from 'dummy/config/environment';\n\nexport default class Router extends EmberRouter {\n  location = config.locationType;\n  rootURL = config.rootURL;\n}\n\nRouter.map(function () {});\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/routes/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/styles/app.css",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/app/templates/application.hbs",
    "content": "{{page-title \"Dummy\"}}\n\n<h2 id=\"title\">Welcome to Ember</h2>\n\n{{outlet}}"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/config/ember-cli-update.json",
    "content": "{\n  \"schemaVersion\": \"1.0.0\",\n  \"packages\": [\n    {\n      \"name\": \"ember-cli\",\n      \"version\": \"3.28.4\",\n      \"blueprints\": [\n        {\n          \"name\": \"addon\",\n          \"outputRepo\": \"https://github.com/ember-cli/ember-addon-output\",\n          \"codemodsSource\": \"ember-addon-codemods-manifest@1\",\n          \"isBaseBlueprint\": true,\n          \"options\": []\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/config/environment.js",
    "content": "'use strict';\n\nmodule.exports = function (environment) {\n  let ENV = {\n    modulePrefix: 'dummy',\n    environment,\n    rootURL: '/',\n    locationType: 'auto',\n    EmberENV: {\n      FEATURES: {\n        // Here you can enable experimental features on an ember canary build\n        // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true\n      },\n      EXTEND_PROTOTYPES: {\n        // Prevent Ember Data from overriding Date.parse.\n        Date: false\n      }\n    },\n\n    APP: {\n      // Here you can pass flags/options to your application instance\n      // when it is created\n    }\n  };\n\n  if (environment === 'development') {\n    // ENV.APP.LOG_RESOLVER = true;\n    // ENV.APP.LOG_ACTIVE_GENERATION = true;\n    // ENV.APP.LOG_TRANSITIONS = true;\n    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;\n    // ENV.APP.LOG_VIEW_LOOKUPS = true;\n  }\n\n  if (environment === 'test') {\n    // Testem prefers this...\n    ENV.locationType = 'none';\n\n    // keep test console output quieter\n    ENV.APP.LOG_ACTIVE_GENERATION = false;\n    ENV.APP.LOG_VIEW_LOOKUPS = false;\n\n    ENV.APP.rootElement = '#ember-testing';\n    ENV.APP.autoboot = false;\n  }\n\n  if (environment === 'production') {\n    // here you can enable a production-specific feature\n  }\n\n  return ENV;\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/config/optional-features.json",
    "content": "{\n  \"application-template-wrapper\": false,\n  \"default-async-observers\": true,\n  \"jquery-integration\": false,\n  \"template-only-glimmer-components\": true\n}\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/config/targets.js",
    "content": "'use strict';\n\nconst browsers = [\n  'last 1 Chrome versions',\n  'last 1 Firefox versions',\n  'last 1 Safari versions'\n];\n\n// Ember's browser support policy is changing, and IE11 support will end in\n// v4.0 onwards.\n//\n// See https://deprecations.emberjs.com/v3.x#toc_3-0-browser-support-policy\n//\n// If you need IE11 support on a version of Ember that still offers support\n// for it, uncomment the code block below.\n//\n// const isCI = Boolean(process.env.CI);\n// const isProduction = process.env.EMBER_ENV === 'production';\n//\n// if (isCI || isProduction) {\n//   browsers.push('ie 11');\n// }\n\nmodule.exports = {\n  browsers\n};\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/dummy/public/robots.txt",
    "content": "# http://www.robotstxt.org\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/helpers/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <title>Dummy Tests</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n    {{content-for \"head\"}}\n    {{content-for \"test-head\"}}\n\n    <link rel=\"stylesheet\" href=\"{{rootURL}}assets/vendor.css\">\n    <link rel=\"stylesheet\" href=\"{{rootURL}}assets/dummy.css\">\n    <link rel=\"stylesheet\" href=\"{{rootURL}}assets/test-support.css\">\n\n    {{content-for \"head-footer\"}}\n    {{content-for \"test-head-footer\"}}\n  </head>\n  <body>\n    {{content-for \"body\"}}\n    {{content-for \"test-body\"}}\n\n    <div id=\"qunit\"></div>\n    <div id=\"qunit-fixture\">\n      <div id=\"ember-testing-container\">\n        <div id=\"ember-testing\"></div>\n      </div>\n    </div>\n\n    <script src=\"/testem.js\" integrity=\"\" data-embroider-ignore></script>\n    <script src=\"{{rootURL}}assets/vendor.js\"></script>\n    <script src=\"{{rootURL}}assets/test-support.js\"></script>\n    <script src=\"{{rootURL}}assets/dummy.js\"></script>\n    <script src=\"{{rootURL}}assets/tests.js\"></script>\n\n    {{content-for \"body-footer\"}}\n    {{content-for \"test-body-footer\"}}\n  </body>\n</html>\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/integration/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/ember/tests/test-helper.js",
    "content": "import Application from 'dummy/app';\nimport config from 'dummy/config/environment';\nimport * as QUnit from 'qunit';\nimport { setApplication } from '@ember/test-helpers';\nimport { setup } from 'qunit-dom';\nimport { start } from 'ember-qunit';\n\nsetApplication(Application.create(config.APP));\n\nsetup(QUnit.assert);\n\nstart();\n"
  },
  {
    "path": "packages/@pollyjs/ember/tests/unit/polly-test.js",
    "content": "import { Polly, Timing, setupQunit as setupPolly } from '@pollyjs/core';\nimport { module, test } from 'qunit';\n\nmodule('Unit | Polly | General', function () {\n  module('Polly', function () {\n    test('it works', function (assert) {\n      assert.strictEqual(typeof Polly, 'function');\n    });\n\n    test('it defaults to an empty string for persisterOptions.rest.host', function (assert) {\n      const polly = new Polly('abc');\n      assert.strictEqual(polly.config.persisterOptions.rest.host, '');\n\n      return polly.stop();\n    });\n  });\n\n  module('setupPolly', function (hooks) {\n    setupPolly(hooks);\n\n    test('it works', function (assert) {\n      assert.ok(this.polly);\n      assert.ok(this.polly instanceof Polly);\n    });\n  });\n\n  module('setupPolly.[beforeEach,afterEach]', function (hooks) {\n    // eslint-disable-next-line qunit/no-hooks-from-ancestor-modules\n    setupPolly.beforeEach(hooks);\n    // eslint-disable-next-line qunit/no-hooks-from-ancestor-modules\n    setupPolly.afterEach(hooks);\n\n    test('it works', function (assert) {\n      assert.ok(this.polly);\n      assert.ok(this.polly instanceof Polly);\n    });\n  });\n\n  module('Timing', function () {\n    test('it works', function (assert) {\n      assert.strictEqual(typeof Timing, 'object');\n      assert.strictEqual(typeof Timing.fixed, 'function');\n      assert.strictEqual(typeof Timing.relative, 'function');\n    });\n  });\n\n  module('auto-registers', function () {\n    test('adapters', async function (assert) {\n      const polly = new Polly('adapters');\n      assert.strictEqual(polly.adapters.size, 2);\n      await polly.stop();\n    });\n\n    test('persister', async function (assert) {\n      const polly = new Polly('persister');\n      assert.strictEqual(typeof polly.persister, 'object');\n      await polly.stop();\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/ember/vendor/.gitkeep",
    "content": ""
  },
  {
    "path": "packages/@pollyjs/node-server/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### Features\n\n* **node-server:** Upgrade dependencies ([#417](https://github.com/netflix/pollyjs/issues/417)) ([246a2f2](https://github.com/netflix/pollyjs/commit/246a2f29a88de9c25fc0739ea5e53a0130a58573))\n\n\n### BREAKING CHANGES\n\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n\n### Features\n\n* **node-server:** Pass options to the CORS middleware via `corsOptions` ([3d991f5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/3d991f5))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n\n### Bug Fixes\n\n* **ember:** loads polly config for ember by its own module ([#277](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/issues/277)) ([0569040](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/0569040))\n\n\n### BREAKING CHANGES\n\n* **ember:** moves location of polly configuration\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/5b4edf3))\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Do not display node server listening banner in quiet mode ([1be57a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/1be57a7))\n* Rest server on Windows ([be5c473](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/be5c473))\n\n\n### Features\n\n* **node-server:** Add cors support to express server to pass-through all requests ([223ce4e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/223ce4e))\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/a04d7a7))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/e622640))\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/d4be431))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/0b47838))\n* Use status code 204 in place of 404. ([#5](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/5)) ([930c492](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/930c492))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@1.0.2...@pollyjs/node-server@1.0.3) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@1.0.1...@pollyjs/node-server@1.0.2) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@1.0.0...@pollyjs/node-server@1.0.1) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/node-server\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@0.4.0...@pollyjs/node-server@1.0.0) (2018-07-20)\n\n\n### Features\n\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/e622640))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/0a0eeca))\n* Presets persisterOptions.host to the node server default ([0b47838](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/0b47838))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"0.4.0\"></a>\n# [0.4.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@0.3.0...@pollyjs/node-server@0.4.0) (2018-06-29)\n\n\n### Bug Fixes\n\n* Do not display node server listening banner in quiet mode ([1be57a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/1be57a7))\n\n\n### Features\n\n* **node-server:** Add cors support to express server to pass-through all requests ([223ce4e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/223ce4e))\n\n\n\n\n<a name=\"0.3.0\"></a>\n# [0.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@0.2.0...@pollyjs/node-server@0.3.0) (2018-06-27)\n\n\n### Features\n\n* Make recording size limit configurable ([#40](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/40)) ([d4be431](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/d4be431))\n\n\n\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/compare/@pollyjs/node-server@0.1.0...@pollyjs/node-server@0.2.0) (2018-06-21)\n\n\n### Bug Fixes\n\n* Rest server on Windows ([be5c473](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/be5c473))\n\n\n### Features\n\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/node-server/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server/commit/a04d7a7))\n"
  },
  {
    "path": "packages/@pollyjs/node-server/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/node-server/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fnode-server.svg)](https://badge.fury.io/js/%40pollyjs%2Fnode-server)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/node-server` package provides a standalone node server as well as\nan express integration to be able to support the [REST Persister](https://netflix.github.io/pollyjs/#/persisters/rest) so recordings can be saved to\nand read from disk.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/node-server -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/node-server -D\n```\n\n## Documentation\n\nCheck out the [Node Server](https://netflix.github.io/pollyjs/#/node-server/overview)\ndocumentation for more details.\n\n## Server\n\nThis packages includes a fully working standalone node server that is pre-configured\nwith the necessary APIs and middleware to support the [REST Persister](https://netflix.github.io/pollyjs/#/persisters/rest).\n\nThe Server constructor accepts a configuration object that can be a combination\nof the below listed Server & API options. Once instantiated, you will have\nfull access to the Express app via the `app` property.\n\n```js\nconst { Server } = require('@pollyjs/node-server');\nconst server = new Server({\n  quiet: true,\n  port: 4000,\n  apiNamespace: '/polly'\n});\n\n// Add custom business logic to the express server\nserver.app.get('/custom', () => {\n  /* Add custom express logic */\n});\n\n// Start listening and attach extra logic to the http server\nserver.listen().on('error', () => {\n  /* Add http server error logic */\n});\n```\n\n## Express Integrations\n\nThe `@pollyjs/node-server` package exports a `registerExpressAPI` method which\ntakes in an [Express](http://expressjs.com/) app and a config to register the\nnecessary routes to be used with the REST Persister.\n\n```js\nconst { registerExpressAPI } = require('@pollyjs/node-server');\n\nregisterExpressAPI(app, config);\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/node-server/package.json",
    "content": "{\n  \"name\": \"@pollyjs/node-server\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Standalone node server and express integration for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-node-server.js\",\n  \"module\": \"dist/es/pollyjs-node-server.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/node-server\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"server\",\n    \"record\",\n    \"replay\",\n    \"express\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"watch\": \"yarn build -w\",\n    \"watch-all\": \"yarn build\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"body-parser\": \"^1.19.0\",\n    \"cors\": \"^2.8.5\",\n    \"express\": \"^4.17.1\",\n    \"fs-extra\": \"^10.0.0\",\n    \"http-graceful-shutdown\": \"^3.1.5\",\n    \"morgan\": \"^1.10.0\",\n    \"nocache\": \"^3.0.1\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/node-server/rollup.config.js",
    "content": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nexport default createNodeConfig({\n  external: ['path']\n});\n"
  },
  {
    "path": "packages/@pollyjs/node-server/src/api.js",
    "content": "import path from 'path';\n\nimport fs from 'fs-extra';\nimport { assert } from '@pollyjs/utils';\n\nexport default class API {\n  constructor(options = {}) {\n    const { recordingsDir } = options;\n\n    assert(\n      `Invalid recordings directory provided. Expected string, received: \"${typeof recordingsDir}\".`,\n      typeof recordingsDir === 'string'\n    );\n\n    this.recordingsDir = recordingsDir;\n  }\n\n  getRecording(recording) {\n    const recordingFilename = this.filenameFor(recording);\n\n    if (fs.existsSync(recordingFilename)) {\n      return this.respond(200, fs.readJsonSync(recordingFilename));\n    }\n\n    return this.respond(204);\n  }\n\n  saveRecording(recording, data) {\n    fs.outputJsonSync(this.filenameFor(recording), data, {\n      spaces: 2\n    });\n\n    return this.respond(201);\n  }\n\n  deleteRecording(recording) {\n    const recordingFilename = this.filenameFor(recording);\n\n    if (fs.existsSync(recordingFilename)) {\n      fs.removeSync(recordingFilename);\n    }\n\n    return this.respond(200);\n  }\n\n  filenameFor(recording) {\n    return path.join(this.recordingsDir, recording, 'recording.har');\n  }\n\n  respond(status, body) {\n    return { status, body };\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/node-server/src/config.js",
    "content": "export default {\n  port: 3000,\n  quiet: false,\n  recordingSizeLimit: '50mb',\n  recordingsDir: 'recordings',\n  apiNamespace: '/polly'\n};\n"
  },
  {
    "path": "packages/@pollyjs/node-server/src/express/register-api.js",
    "content": "import bodyParser from 'body-parser';\nimport express from 'express';\nimport nocache from 'nocache';\n\nimport API from '../api';\nimport DefaultConfig from '../config';\n\nfunction prependSlash(slash = '') {\n  if (slash.startsWith('/')) {\n    return slash;\n  }\n\n  return `/${slash}`;\n}\n\nexport default function registerAPI(app, config) {\n  config = { ...DefaultConfig, ...config };\n  config.apiNamespace = prependSlash(config.apiNamespace);\n\n  const router = express.Router();\n  const api = new API({ recordingsDir: config.recordingsDir });\n\n  router.use(nocache());\n\n  router.get('/:recording', function (req, res) {\n    const { recording } = req.params;\n    const { status, body } = api.getRecording(recording);\n\n    res.status(status);\n\n    if (status === 200) {\n      res.json(body);\n    } else {\n      res.end();\n    }\n  });\n\n  router.post(\n    '/:recording',\n    bodyParser.json({ limit: config.recordingSizeLimit }),\n    function (req, res) {\n      const { recording } = req.params;\n      const { status, body } = api.saveRecording(recording, req.body);\n\n      res.status(status).send(body);\n    }\n  );\n\n  router.delete('/:recording', function (req, res) {\n    const { recording } = req.params;\n    const { status, body } = api.deleteRecording(recording);\n\n    res.status(status).send(body);\n  });\n\n  app.use(config.apiNamespace, router);\n}\n"
  },
  {
    "path": "packages/@pollyjs/node-server/src/index.js",
    "content": "export { default as API } from './api';\nexport { default as Server } from './server';\nexport { default as Defaults } from './config';\nexport { default as registerExpressAPI } from './express/register-api';\n"
  },
  {
    "path": "packages/@pollyjs/node-server/src/server.js",
    "content": "/* global process */\n\nimport cors from 'cors';\nimport morgan from 'morgan';\nimport express from 'express';\nimport gracefulShutdown from 'http-graceful-shutdown';\n\nimport registerAPI from './express/register-api';\nimport DefaultConfig from './config';\n\nexport default class Server {\n  constructor(config = {}) {\n    this.config = { ...DefaultConfig, ...config };\n    this.app = express();\n    this.app.use(cors(this.config.corsOptions));\n\n    if (!this.config.quiet) {\n      this.app.use(morgan('dev'));\n    }\n\n    // Return 200 on root GET & HEAD to pass health checks\n    this.app.get('/', (req, res) => res.sendStatus(200));\n    this.app.head('/', (req, res) => res.sendStatus(200));\n\n    registerAPI(this.app, {\n      recordingsDir: this.config.recordingsDir,\n      apiNamespace: this.config.apiNamespace\n    });\n  }\n\n  listen(port, host) {\n    if (this.server) {\n      return;\n    }\n\n    port = port || this.config.port;\n    host = host || this.config.host;\n\n    this.server = this.app\n      .listen(port, host)\n      .on('listening', () => {\n        if (!this.config.quiet) {\n          console.log(`Listening on http://${host || 'localhost'}:${port}/\\n`);\n        }\n      })\n      .on('error', (e) => {\n        if (e.code === 'EADDRINUSE') {\n          console.error(`Port ${port} already in use.`);\n          process.exit(1);\n        } else {\n          console.error(e);\n        }\n      });\n\n    gracefulShutdown(this.server);\n\n    return this.server;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/node-server/types.d.ts",
    "content": "import * as http from 'http';\nimport * as express from 'express';\nimport * as cors from 'cors';\n\nexport interface Config {\n  port: number;\n  quiet: boolean;\n  recordingSizeLimit: string;\n  recordingsDir: string;\n  apiNamespace: string;\n}\n\nexport interface ServerConfig extends Config {\n  corsOptions?: cors.CorsOptions | undefined;\n}\n\nexport const Defaults: Config;\n\nexport interface APIResponse {\n  status: number;\n  body?: any;\n}\n\nexport class API {\n  constructor(options: Pick<Config, 'recordingsDir'>);\n  getRecordings(recording: string): APIResponse;\n  saveRecording(recording: string, data: any): APIResponse;\n  deleteRecording(recording: string): APIResponse;\n  filenameFor(recording: string): string;\n  respond(status: number, data?: any): APIResponse;\n}\n\nexport class Server {\n  config: ServerConfig;\n  app: express.Express;\n  server?: http.Server | undefined;\n\n  constructor(options?: Partial<ServerConfig>);\n  listen(port?: number, host?: string): http.Server;\n}\n\nexport function registerExpressAPI(\n  app: express.Express,\n  config: Partial<Config>\n): void;\n"
  },
  {
    "path": "packages/@pollyjs/persister/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n\n### Bug Fixes\n\n* **persister:** `requests` -> `request` in `HarEntry` declaration ([#441](https://github.com/netflix/pollyjs/issues/441)) ([6466810](https://github.com/netflix/pollyjs/commit/6466810677b6ac2c6a7496335bf40e043ab843e1))\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n\n### Bug Fixes\n\n* Update types for class methods ([#438](https://github.com/netflix/pollyjs/issues/438)) ([b88655a](https://github.com/netflix/pollyjs/commit/b88655ac1b4ca7348afd45e9aeaa50e998ea68d7))\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n\n### Bug Fixes\n\n* A few more type fixes ([#437](https://github.com/netflix/pollyjs/issues/437)) ([5e837a2](https://github.com/netflix/pollyjs/commit/5e837a25d28393b764cb66bcae0b29e9273eabe8))\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n\n### Bug Fixes\n\n* **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ([cc2fa19](https://github.com/netflix/pollyjs/commit/cc2fa197a5c0a5fdef4602c4a207d31f3e677897))\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n### Bug Fixes\n\n* **persister:** Only treat status codes >= 400 as failed ([#430](https://github.com/netflix/pollyjs/issues/430)) ([7658952](https://github.com/netflix/pollyjs/commit/765895232746cd560da6bd566de8a312045b1703))\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat!: Improve logging and add logLevel (#427) ([bef3ee3](https://github.com/netflix/pollyjs/commit/bef3ee39f71dfc2fa4dbeb522dfba16d01243e9f)), closes [#427](https://github.com/netflix/pollyjs/issues/427)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* 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. \n* Recording file name will no longer have trailing dashes\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Features\n\n* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/1223ba0))\n\n\n### BREAKING CHANGES\n\n* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n\n### Bug Fixes\n\n* **adapter-node-http:** Improve binary response body handling ([#329](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/329)) ([9466989](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/9466989))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/8fd4d19))\n\n\n### Features\n\n* **persister:** Add `disableSortingHarEntries` option ([#321](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/321)) ([0003c0e](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0003c0e))\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Bug Fixes\n\n* Bowser.getParser empty string UserAgent error ([#246](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/246)) ([2c9c4b9](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/2c9c4b9))\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n\n### Bug Fixes\n\n* **persister:** Default to empty string if userAgent is empty ([#242](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/issues/242)) ([c46d65c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/c46d65c))\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n\n### Bug Fixes\n\n* Correctly handle array header values ([#179](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/179)) ([fb7dbb4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/fb7dbb4))\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Bug Fixes\n\n* **persister:** Only persist post data if a request has a body ([#171](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/171)) ([f62d318](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/f62d318))\n\n\n### Features\n\n* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/5b07b26))\n\n\n### BREAKING CHANGES\n\n* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/persister\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/19fee5a))\n* **persister:** Handle concurrent find requests ([#88](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/88)) ([0e02414](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0e02414))\n\n\n### Features\n\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0a3d591))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/e622640))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/8bb313c))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0a0eeca))\n* **core:** Server level configuration ([#80](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/80)) ([0f32d9b](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0f32d9b))\n* **persister:** Add `keepUnusedRequests` config option ([#108](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/108)) ([3f5f5b2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/3f5f5b2))\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/a04d7a7))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@1.0.3...@pollyjs/persister@1.0.4) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@1.0.2...@pollyjs/persister@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@1.0.1...@pollyjs/persister@1.0.2) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@1.0.0...@pollyjs/persister@1.0.1) (2018-08-09)\n\n\n### Bug Fixes\n\n* **persister:** Handle concurrent find requests ([#88](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/88)) ([0e02414](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0e02414))\n\n\n\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@0.2.1...@pollyjs/persister@1.0.0) (2018-07-20)\n\n\n### Bug Fixes\n\n* Creator cleanup and persister assertion ([#67](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/67)) ([19fee5a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/19fee5a))\n\n\n### Features\n\n* Class events and EventEmitter ([#52](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/52)) ([0a3d591](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0a3d591))\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/e622640))\n* Keyed persister & adapter options ([#60](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/60)) ([29ed8e1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/29ed8e1))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/0a0eeca))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"0.2.1\"></a>\n## [0.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@0.2.0...@pollyjs/persister@0.2.1) (2018-06-27)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister\n\n<a name=\"0.2.0\"></a>\n# [0.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/compare/@pollyjs/persister@0.1.0...@pollyjs/persister@0.2.0) (2018-06-21)\n\n\n### Features\n\n* **persister:** Cache recordings ([#31](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister/issues/31)) ([a04d7a7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/a04d7a7))\n\n\n\n\n<a name=\"0.1.0\"></a>\n# 0.1.0 (2018-06-16)\n\n\n### Features\n\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister/commit/8bb313c))\n"
  },
  {
    "path": "packages/@pollyjs/persister/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/persister/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fpersister.svg)](https://badge.fury.io/js/%40pollyjs%2Fpersister)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/persister` package provides an extendable base persister class that\ncontains core logic dependent on by the [REST](https://netflix.github.io/pollyjs/#/persisters/rest)\n& [Local Storage](https://netflix.github.io/pollyjs/#/persisters/local-storage) persisters.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister -D\n```\n\n## Documentation\n\nCheck out the [Custom Persister](https://netflix.github.io/pollyjs/#/persisters/custom)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport Persister from '@pollyjs/persister';\n\nclass CustomPersister extends Persister {\n  static get id() {\n    return 'custom';\n  }\n\n  onFindRecording() {}\n\n  onSaveRecording() {}\n\n  onDeleteRecording() {}\n}\n```\n\nFor better usage examples, please refer to the source code for\nthe [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.\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/persister/package.json",
    "content": "{\n  \"name\": \"@pollyjs/persister\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Extendable base persister class used by @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-persister.js\",\n  \"module\": \"dist/es/pollyjs-persister.js\",\n  \"browser\": \"dist/umd/pollyjs-persister.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister\",\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"persister\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"@pollyjs/utils\": \"^6.0.6\",\n    \"@types/set-cookie-parser\": \"^2.4.1\",\n    \"bowser\": \"^2.4.0\",\n    \"fast-json-stable-stringify\": \"^2.1.0\",\n    \"lodash-es\": \"^4.17.21\",\n    \"set-cookie-parser\": \"^2.4.8\",\n    \"utf8-byte-length\": \"^1.0.4\"\n  },\n  \"devDependencies\": {\n    \"har-validator\": \"^5.1.5\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createNodeTestConfig(), createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/entry.js",
    "content": "import Request from './request';\nimport Response from './response';\n\nconst { keys } = Object;\n\nfunction totalTime(timings = {}) {\n  return keys(timings).reduce(\n    (total, k) => (timings[k] > 0 ? (total += timings[k]) : total),\n    0\n  );\n}\n\nexport default class Entry {\n  constructor(request) {\n    this._id = request.id;\n    this._order = request.order;\n    this.startedDateTime = request.timestamp;\n    this.request = new Request(request);\n    this.response = new Response(request.response);\n    this.cache = {};\n    this.timings = {\n      blocked: -1,\n      dns: -1,\n      connect: -1,\n      send: 0,\n      wait: request.responseTime,\n      receive: 0,\n      ssl: -1\n    };\n    this.time = totalTime(this.timings);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/index.js",
    "content": "import Log from './log';\n\nexport default class HAR {\n  constructor(opts = {}) {\n    this.log = new Log(opts.log);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/log.js",
    "content": "import uniqWith from 'lodash-es/uniqWith';\nimport Bowser from 'bowser';\n\nconst bowser =\n  global.navigator && global.navigator.userAgent\n    ? Bowser.getParser(global.navigator.userAgent).getBrowser()\n    : null;\nconst browser =\n  bowser && bowser.name && bowser.version\n    ? { name: bowser.name, version: bowser.version }\n    : null;\n\nexport default class Log {\n  constructor(opts = {}) {\n    // eslint-disable-next-line no-restricted-properties\n    Object.assign(\n      this,\n      {\n        version: '1.2',\n        entries: [],\n        pages: []\n      },\n      opts\n    );\n\n    if (!this.browser && browser) {\n      this.browser = browser;\n    }\n  }\n\n  addEntries(entries = []) {\n    this.entries = uniqWith(\n      // Add the new entries to the front so they take priority\n      [...entries, ...this.entries],\n      (a, b) => a._id === b._id && a._order === b._order\n    );\n  }\n\n  sortEntries() {\n    this.entries = this.entries.sort(\n      (a, b) => new Date(a.startedDateTime) - new Date(b.startedDateTime)\n    );\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/request.js",
    "content": "import getByteLength from 'utf8-byte-length';\nimport setCookies from 'set-cookie-parser';\n\nimport toNVPairs from './utils/to-nv-pairs';\nimport getFirstHeader from './utils/get-first-header';\n\nfunction headersSize(request) {\n  const keys = [];\n  const values = [];\n\n  request.headers.forEach(({ name, value }) => {\n    keys.push(name);\n    values.push(value);\n  });\n\n  const headersString =\n    request.method + request.url + keys.join() + values.join();\n\n  // startline: [method] [url] HTTP/1.1\\r\\n = 12\n  // endline: \\r\\n = 2\n  // every header + \\r\\n = * 2\n  // add 2 for each combined header\n  return getByteLength(headersString) + keys.length * 2 + 2 + 12 + 2;\n}\n\nexport default class Request {\n  constructor(request) {\n    this.httpVersion = 'HTTP/1.1';\n    this.url = request.absoluteUrl;\n    this.method = request.method;\n    this.headers = toNVPairs(request.headers);\n    this.headersSize = headersSize(this);\n    this.queryString = toNVPairs(request.query);\n    this.cookies = setCookies.parse(request.getHeader('Set-Cookie'));\n\n    if (request.body) {\n      this.postData = {\n        mimeType: getFirstHeader(request, 'Content-Type') || 'text/plain',\n        params: []\n      };\n\n      if (typeof request.body === 'string') {\n        this.postData.text = request.body;\n      }\n    }\n\n    const contentLength = getFirstHeader(request, 'Content-Length');\n\n    if (contentLength) {\n      this.bodySize = parseInt(contentLength, 10);\n    } else {\n      this.bodySize =\n        this.postData && this.postData.text\n          ? getByteLength(this.postData.text)\n          : 0;\n    }\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/response.js",
    "content": "import getByteLength from 'utf8-byte-length';\nimport setCookies from 'set-cookie-parser';\n\nimport toNVPairs from './utils/to-nv-pairs';\nimport getFirstHeader from './utils/get-first-header';\n\nfunction headersSize(response) {\n  const keys = [];\n  const values = [];\n\n  response.headers.forEach(({ name, value }) => {\n    keys.push(name);\n    values.push(value);\n  });\n\n  const headersString = keys.join() + values.join();\n\n  // endline: \\r\\n = 2\n  // every header + \\r\\n = * 2\n  // add 2 for each combined header\n  return getByteLength(headersString) + keys.length * 2 + 2 + 2;\n}\n\nexport default class Response {\n  constructor(response) {\n    this.httpVersion = 'HTTP/1.1';\n    this.status = response.statusCode;\n    this.statusText = response.statusText;\n    this.headers = toNVPairs(response.headers);\n    this.headersSize = headersSize(this);\n    this.cookies = setCookies.parse(response.getHeader('Set-Cookie'));\n    this.redirectURL = getFirstHeader(response, 'Location') || '';\n\n    this.content = {\n      mimeType: getFirstHeader(response, 'Content-Type') || 'text/plain'\n    };\n\n    if (response.body && typeof response.body === 'string') {\n      this.content.text = response.body;\n\n      if (response.encoding) {\n        this.content.encoding = response.encoding;\n      }\n    }\n\n    const contentLength = getFirstHeader(response, 'Content-Length');\n\n    if (contentLength) {\n      this.content.size = parseInt(contentLength, 10);\n    } else {\n      this.content.size = this.content.text\n        ? getByteLength(this.content.text)\n        : 0;\n    }\n\n    this.bodySize = this.content.size;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/utils/get-first-header.js",
    "content": "const { isArray } = Array;\n\n/**\n * Get the value of the given header name. If the value is an array,\n * get the first value.\n *\n * @export\n * @param {PollyRequest | PollyResponse} r\n * @param {string} name\n * @returns {string | undefined}\n */\nexport default function getFirstHeader(r, name) {\n  const value = r.getHeader(name);\n\n  if (isArray(value)) {\n    return value.length > 0 ? value[0] : '';\n  }\n\n  return value;\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/har/utils/to-nv-pairs.js",
    "content": "const { keys } = Object;\nconst { isArray } = Array;\n\nexport default function toNVPairs(o) {\n  return keys(o || {}).reduce((pairs, name) => {\n    const value = o[name];\n\n    if (isArray(value)) {\n      // _fromType is used to convert the stored header back into the\n      // type it originally was. Take the following example:\n      //   { 'content-type': ['text/htm'] }\n      //     => { name: 'content-type', value: 'text/html', _fromType: 'array }\n      //     => { 'content-type': ['text/htm'] }\n      pairs.push(...value.map((v) => ({ name, value: v, _fromType: 'array' })));\n    } else {\n      pairs.push({ name, value });\n    }\n\n    return pairs;\n  }, []);\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/src/index.js",
    "content": "import stringify from 'fast-json-stable-stringify';\nimport { ACTIONS, assert } from '@pollyjs/utils';\n\nimport HAR from './har';\nimport Entry from './har/entry';\n\nconst CREATOR_NAME = 'Polly.JS';\n\nexport default class Persister {\n  constructor(polly) {\n    this.polly = polly;\n    this.pending = new Map();\n    this._cache = new Map();\n  }\n\n  static get type() {\n    return 'persister';\n  }\n\n  /* eslint-disable-next-line getter-return */\n  static get id() {\n    assert('Must override the static `id` getter.');\n  }\n\n  get defaultOptions() {\n    return {};\n  }\n\n  get options() {\n    return {\n      ...(this.defaultOptions || {}),\n      ...((this.polly.config.persisterOptions || {})[this.constructor.id] || {})\n    };\n  }\n\n  get hasPending() {\n    /*\n      Although the pending map is bucketed by recordingId, the bucket will always\n      be created with a single item in it so we can assume that if a bucket\n      exists, then it has items in it.\n    */\n    return this.pending.size > 0;\n  }\n\n  async persist() {\n    if (!this.hasPending) {\n      return;\n    }\n\n    const promises = [];\n    const creator = {\n      name: CREATOR_NAME,\n      version: this.polly.constructor.VERSION,\n      comment: `${this.constructor.type}:${this.constructor.id}`\n    };\n\n    for (const [recordingId, { name, requests }] of this.pending) {\n      const entries = [];\n      const recording = await this.findRecording(recordingId);\n      let har;\n\n      if (!recording) {\n        har = new HAR({ log: { creator, _recordingName: name } });\n      } else {\n        har = new HAR(recording);\n      }\n\n      for (const request of requests) {\n        const entry = new Entry(request);\n\n        this.assert(\n          `Cannot persist response for [${entry.request.method}] ${entry.request.url} because the status code was ${entry.response.status} and \\`recordFailedRequests\\` is \\`false\\``,\n          entry.response.status < 400 || request.config.recordFailedRequests\n        );\n\n        /*\n          Trigger the `beforePersist` event on each new recorded entry.\n\n          NOTE: This must be triggered last as this entry can be used to\n                modify the payload (i.e. encrypting the request & response).\n        */\n        await request._emit('beforePersist', entry);\n        entries.push(entry);\n      }\n\n      har.log.addEntries(entries);\n\n      if (!this.polly.config.persisterOptions.disableSortingHarEntries) {\n        har.log.sortEntries();\n      }\n\n      if (!this.polly.config.persisterOptions.keepUnusedRequests) {\n        this._removeUnusedEntries(recordingId, har);\n      }\n\n      promises.push(this.saveRecording(recordingId, har));\n    }\n\n    await Promise.all(promises);\n    this.pending.clear();\n  }\n\n  recordRequest(pollyRequest) {\n    this.assert(\n      `You must pass a PollyRequest to 'recordRequest'.`,\n      pollyRequest\n    );\n    this.assert(\n      `Cannot save a request with no response.`,\n      pollyRequest.didRespond\n    );\n\n    const { recordingId, recordingName } = pollyRequest;\n\n    if (!this.pending.has(recordingId)) {\n      this.pending.set(recordingId, { name: recordingName, requests: [] });\n    }\n\n    this.pending.get(recordingId).requests.push(pollyRequest);\n  }\n\n  async findRecording(recordingId) {\n    const { _cache: cache } = this;\n\n    if (!cache.has(recordingId)) {\n      const onFindRecording = async () => {\n        const recording = await this.onFindRecording(recordingId);\n\n        if (recording) {\n          this.assert(\n            `Recording with id '${recordingId}' is invalid. Please delete the recording so a new one can be created.`,\n            recording.log && recording.log.creator.name === CREATOR_NAME\n          );\n\n          return recording;\n        } else {\n          cache.delete(recordingId);\n\n          return null;\n        }\n      };\n\n      cache.set(recordingId, onFindRecording());\n    }\n\n    return cache.get(recordingId);\n  }\n\n  onFindRecording() {\n    this.assert('Must implement the `onFindRecording` hook.');\n  }\n\n  async saveRecording(recordingId, har) {\n    await this.onSaveRecording(...arguments);\n    this._cache.delete(recordingId);\n    this.polly.logger.log.debug('Recording saved.', { recordingId, har });\n  }\n\n  onSaveRecording() {\n    this.assert('Must implement the `onSaveRecording` hook.');\n  }\n\n  async deleteRecording(recordingId) {\n    await this.onDeleteRecording(...arguments);\n    this._cache.delete(recordingId);\n  }\n\n  onDeleteRecording() {\n    this.assert('Must implement the `onDeleteRecording` hook.');\n  }\n\n  async findEntry(pollyRequest) {\n    const { id, order, recordingId } = pollyRequest;\n    const recording = await this.findRecording(recordingId);\n\n    return (\n      (recording &&\n        recording.log.entries.find(\n          (entry) => entry._id === id && entry._order === order\n        )) ||\n      null\n    );\n  }\n\n  stringify() {\n    return stringify(...arguments);\n  }\n\n  assert(message, ...args) {\n    assert(\n      `[${this.constructor.type}:${this.constructor.id}] ${message}`,\n      ...args\n    );\n  }\n\n  /**\n   * Remove all entries from the given HAR that do not match any requests in\n   * the current Polly instance.\n   *\n   * @param {String} recordingId\n   * @param {HAR} har\n   */\n  _removeUnusedEntries(recordingId, har) {\n    const requests = this.polly._requests.filter(\n      (r) =>\n        r.recordingId === recordingId &&\n        (r.action === ACTIONS.RECORD || r.action === ACTIONS.REPLAY)\n    );\n\n    har.log.entries = har.log.entries.filter((entry) =>\n      requests.find((r) => entry._id === r.id && entry._order === r.order)\n    );\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister/tests/unit/har-test.js",
    "content": "import * as validate from 'har-validator/lib/async';\n\nimport HAR from '../../src/har';\nimport Log from '../../src/har/log';\nimport Entry from '../../src/har/entry';\nimport Request from '../../src/har/request';\nimport Response from '../../src/har/response';\n\ndescribe('Unit | HAR', function () {\n  it('should exist', function () {\n    expect(HAR).to.be.a('function');\n    expect(Log).to.be.a('function');\n    expect(Entry).to.be.a('function');\n    expect(Request).to.be.a('function');\n    expect(Response).to.be.a('function');\n  });\n\n  describe('Log', function () {\n    it('should merge passed options', async function () {\n      expect(new Log({ foo: 'foo' })).to.deep.include({ foo: 'foo' });\n    });\n\n    it('should require creator', async function () {\n      expect(await validate.log(new Log())).to.be.false;\n    });\n\n    it('should be valid', async function () {\n      expect(\n        await validate.log(\n          new Log({\n            creator: { name: 'Polly.JS', version: '0.0.0' }\n          })\n        )\n      ).to.be.true;\n    });\n\n    it('addEntries: Entries should be unique', async function () {\n      const now = new Date().getTime();\n      const log = new Log({\n        entries: [\n          {\n            _id: 'abc',\n            _order: 0,\n            startedDateTime: new Date(now),\n            _new: false\n          },\n          {\n            _id: 'def',\n            _order: 0,\n            startedDateTime: new Date(now + 10),\n            _new: false\n          }\n        ]\n      });\n\n      log.addEntries([\n        {\n          _id: 'abc',\n          _order: 0,\n          startedDateTime: new Date(now + 100),\n          _new: true\n        },\n        {\n          _id: 'abc',\n          _order: 1,\n          startedDateTime: new Date(now + 105),\n          _new: true\n        },\n        { _id: 'ghi', _order: 0, startedDateTime: new Date(now), _new: true }\n      ]);\n\n      expect(\n        log.entries.map(({ _id, _order, _new }) => ({ _id, _order, _new }))\n      ).to.include.deep.ordered.members([\n        { _id: 'abc', _order: 0, _new: true },\n        { _id: 'abc', _order: 1, _new: true },\n        { _id: 'ghi', _order: 0, _new: true },\n        { _id: 'def', _order: 0, _new: false }\n      ]);\n    });\n\n    it('sortEntries: sorts by startedDateTime', async function () {\n      const now = new Date().getTime();\n      const log = new Log({\n        entries: [\n          { _id: 'd', startedDateTime: new Date(now + 15) },\n          { _id: 'b', startedDateTime: new Date(now + 5) },\n          { _id: 'a', startedDateTime: new Date(now + 0) },\n          { _id: 'c', startedDateTime: new Date(now + 10) }\n        ]\n      });\n\n      log.sortEntries();\n\n      expect(log.entries.map((e) => e._id)).to.have.deep.ordered.members([\n        'a',\n        'b',\n        'c',\n        'd'\n      ]);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/persister/tests/unit/persister-test.js",
    "content": "import { timeout } from '@pollyjs/utils';\n\nimport Persister from '../../src';\n\ndescribe('Unit | Persister', function () {\n  it('should exist', function () {\n    expect(Persister).to.be.a('function');\n  });\n\n  describe('Caching', function () {\n    let callCounts, recording;\n\n    beforeEach(function () {\n      callCounts = { find: 0, save: 0, delete: 0 };\n      recording = {\n        log: {\n          creator: {\n            name: 'Polly.JS'\n          }\n        }\n      };\n\n      class CustomPersister extends Persister {\n        static get id() {\n          return 'CustomPersister';\n        }\n\n        async onFindRecording() {\n          callCounts.find++;\n          await timeout(1);\n\n          return recording;\n        }\n\n        async onSaveRecording() {\n          callCounts.save++;\n          await timeout(1);\n        }\n\n        async onDeleteRecording() {\n          callCounts.delete++;\n          await timeout(1);\n        }\n      }\n\n      this.persister = new CustomPersister({\n        logger: {\n          log: { debug: () => {} }\n        }\n      });\n    });\n\n    it('should handle concurrent find requests', async function () {\n      await Promise.all([\n        this.persister.findRecording('test'),\n        this.persister.findRecording('test'),\n        this.persister.findRecording('test')\n      ]);\n\n      expect(callCounts.find).to.equal(1);\n    });\n\n    it('caches', async function () {\n      await this.persister.findRecording('test');\n      await this.persister.findRecording('test');\n      await this.persister.findRecording('test');\n\n      expect(callCounts.find).to.equal(1);\n    });\n\n    it('does not cache falsy values', async function () {\n      recording = null;\n\n      await this.persister.findRecording('test');\n      await Promise.all([\n        this.persister.findRecording('test'),\n        this.persister.findRecording('test'),\n        this.persister.findRecording('test')\n      ]);\n      await this.persister.findRecording('test');\n\n      expect(callCounts.find).to.equal(3);\n    });\n\n    it('busts the cache after a save', async function () {\n      await this.persister.findRecording('test');\n      await this.persister.saveRecording('test');\n      await this.persister.findRecording('test');\n      await this.persister.findRecording('test');\n\n      expect(callCounts.save).to.equal(1);\n      expect(callCounts.find).to.equal(2);\n    });\n\n    it('busts the cache after a delete', async function () {\n      await this.persister.findRecording('test');\n      await this.persister.deleteRecording('test');\n      await this.persister.findRecording('test');\n      await this.persister.findRecording('test');\n\n      expect(callCounts.delete).to.equal(1);\n      expect(callCounts.find).to.equal(2);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/persister/types.d.ts",
    "content": "import { Polly, Request } from '@pollyjs/core';\nimport { Cookie } from 'set-cookie-parser';\n\ntype NVObject = { name: string; value: string };\n\nexport interface HarRequest {\n  httpVersion: string;\n  url: string;\n  method: string;\n  headers: NVObject[];\n  headersSize: number;\n  queryString: NVObject[];\n  cookies: Cookie[];\n  postData?: {\n    mimeType: string;\n    params: [];\n    text?: string;\n  };\n  bodySize?: number;\n}\n\nexport interface HarResponse {\n  httpVersion: string;\n  status: number;\n  statusText: string;\n  headers: NVObject[];\n  headersSize: number;\n  cookies: Cookie[];\n  content: {\n    mimeType: string;\n    text?: string;\n    encoding?: string;\n    size?: number;\n  };\n  bodySize?: number;\n}\n\nexport interface HarEntry {\n  _id: string;\n  _order: number;\n  startedDateTime: string;\n  request: HarRequest;\n  response: HarResponse;\n  cache: {};\n  timings: {\n    blocked: number;\n    dns: number;\n    connect: number;\n    send: number;\n    wait: number;\n    receive: number;\n    ssl: number;\n  };\n  time: number;\n}\n\nexport interface HarLog {\n  version: string;\n  browser: string;\n  entries: HarEntry[];\n  pages: [];\n  addEntries(entries: HarEntry[]): void;\n  sortEntries(): void;\n}\n\nexport interface Har {\n  log: HarLog;\n}\n\nexport default class Persister<TOptions extends {} = {}> {\n  static readonly id: string;\n  static readonly type: string;\n  constructor(polly: Polly);\n  readonly defaultOptions: TOptions;\n  readonly options: TOptions;\n  private pending: Map<string, { name: string; recordings: Request[] }>;\n  private _cache: Map<string, Har>;\n  polly: Polly;\n  hasPending: boolean;\n  persist(): Promise<void>;\n  recordRequest(request: Request): void;\n  private findRecording(recordingId: string): Promise<Har | null>;\n  onFindRecording(recordingId: string): Promise<Har | null>;\n  private saveRecording(recordingId: string, har: Har): Promise<void>;\n  onSaveRecording(recordingId: string, har: Har): Promise<void>;\n  private deleteRecording(recordingId: string): Promise<void>;\n  onDeleteRecording(recordingId: string): Promise<void>;\n  findEntry(request: Request): Promise<HarEntry | null>;\n  stringify(value: any): string;\n  assert(message: string, condition?: boolean): void;\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/.eslintrc.js",
    "content": "module.exports = {\n  env: {\n    browser: false,\n    node: true\n  }\n};\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* Recording file name will no longer have trailing dashes\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [4.2.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.1.0...v4.2.0) (2020-04-29)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v1.4.1...v1.4.2) (2019-01-16)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Features\n\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister-fs/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister-fs/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/f902c6d))\n\n\n\n\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/@pollyjs/persister-fs@1.0.4...@pollyjs/persister-fs@1.0.5) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/@pollyjs/persister-fs@1.0.3...@pollyjs/persister-fs@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/@pollyjs/persister-fs@1.0.2...@pollyjs/persister-fs@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/@pollyjs/persister-fs@1.0.1...@pollyjs/persister-fs@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/compare/@pollyjs/persister-fs@1.0.0...@pollyjs/persister-fs@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-fs\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n### Features\n\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister-fs/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/persister-fs/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs/commit/f902c6d))\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fpersister-fs.svg)](https://badge.fury.io/js/%40pollyjs%2Fpersister-fs)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/persister-fs` package provides a node file-system persister\nto be used with `@pollyjs/core`.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-fs -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-fs -D\n```\n\n## Documentation\n\nCheck out the [FS Persister](https://netflix.github.io/pollyjs/#/persisters/fs)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport FSPersister from '@pollyjs/persister-fs';\n\nPolly.register(FSPersister);\n\nnew Polly('<Recording Name>', {\n  persister: ['fs']\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/package.json",
    "content": "{\n  \"name\": \"@pollyjs/persister-fs\",\n  \"version\": \"6.0.6\",\n  \"description\": \"File system persister for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-persister-fs.js\",\n  \"module\": \"dist/es/pollyjs-persister-fs.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"fs\",\n    \"file\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"build:watch\": \"yarn build -w\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/node-server\": \"^6.0.6\",\n    \"@pollyjs/persister\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"fixturify\": \"^2.1.1\",\n    \"rimraf\": \"^3.0.2\",\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/rollup.config.js",
    "content": "import createNodeConfig from '../../../scripts/rollup/node.config';\n\nexport default createNodeConfig();\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\n\nexport default createNodeTestConfig({\n  external: ['rimraf', 'fixturify']\n});\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/src/index.js",
    "content": "import Persister from '@pollyjs/persister';\nimport { API, Defaults } from '@pollyjs/node-server';\n\nconst { parse } = JSON;\n\nexport default class FSPersister extends Persister {\n  constructor() {\n    super(...arguments);\n    this.api = new API(this.options);\n  }\n\n  static get id() {\n    return 'fs';\n  }\n\n  get defaultOptions() {\n    return {\n      recordingsDir: Defaults.recordingsDir\n    };\n  }\n\n  onFindRecording(recordingId) {\n    return this.api.getRecording(recordingId).body || null;\n  }\n\n  onSaveRecording(recordingId, data) {\n    /*\n      Pass the data through the base persister's stringify method so\n      the output will be consistent with the rest of the persisters.\n    */\n    this.api.saveRecording(recordingId, parse(this.stringify(data)));\n  }\n\n  onDeleteRecording(recordingId) {\n    this.api.deleteRecording(recordingId);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/tests/unit/persister-test.js",
    "content": "import rimraf from 'rimraf';\nimport fixturify from 'fixturify';\n\nimport FSPersister from '../../src';\n\nclass MockPolly {\n  constructor(persisterOptions = {}) {\n    this.config = {\n      persisterOptions: { fs: persisterOptions || {} }\n    };\n  }\n}\n\ndescribe('Unit | FS Persister', function () {\n  afterEach(function () {\n    rimraf.sync('recordings');\n  });\n\n  it('should exist', function () {\n    expect(FSPersister).to.be.a('function');\n  });\n\n  it('should have a id', function () {\n    expect(FSPersister.id).to.equal('fs');\n  });\n\n  describe('Options', function () {\n    it('recordingsDir', function () {\n      let persister = new FSPersister(new MockPolly());\n\n      expect(persister.options.recordingsDir)\n        .to.equal(persister.defaultOptions.recordingsDir)\n        .and.to.equal('recordings');\n\n      persister = new FSPersister(\n        new MockPolly({\n          recordingsDir: 'recordings/tmp'\n        })\n      );\n\n      expect(persister.options.recordingsDir)\n        .to.equal('recordings/tmp')\n        .and.to.not.equal(persister.defaultOptions.recordingsDir);\n\n      fixturify.writeSync('recordings/tmp', {\n        'FS-Persister': {\n          'recording.har': '{}'\n        }\n      });\n\n      expect(persister.onFindRecording('FS-Persister')).to.deep.equal({});\n    });\n  });\n\n  describe('API', function () {\n    beforeEach(function () {\n      this.persister = new FSPersister(new MockPolly());\n\n      fixturify.writeSync('recordings', {\n        'FS-Persister': {\n          'recording.har': '{}'\n        }\n      });\n    });\n\n    it('onSaveRecording', function () {\n      expect(this.persister.onFindRecording('FS-Persister')).to.deep.equal({});\n\n      this.persister.onSaveRecording('FS-Persister', { foo: 'bar' });\n      expect(this.persister.onFindRecording('FS-Persister')).to.deep.equal({\n        foo: 'bar'\n      });\n    });\n\n    it('onFindRecording', function () {\n      expect(this.persister.onFindRecording('FS-Persister')).to.deep.equal({});\n      expect(this.persister.onFindRecording('Does-Not-Exist')).to.be.null;\n    });\n\n    it('onDeleteRecording', function () {\n      expect(this.persister.onFindRecording('FS-Persister')).to.not.be.null;\n\n      this.persister.onDeleteRecording('FS-Persister');\n      expect(this.persister.onFindRecording('Does-Not-Exist')).to.be.null;\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/persister-fs/types.d.ts",
    "content": "import Persister from '@pollyjs/persister';\n\nexport default class FSPersister extends Persister<{\n  recordingsDir?: string;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/persister-in-memory\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n\n### Features\n\n* Adds an in-memory persister to test polly internals ([#237](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/issues/237)) ([5a6fda6](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory/commit/5a6fda6))\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/package.json",
    "content": "{\n  \"name\": \"@pollyjs/persister-in-memory\",\n  \"version\": \"6.0.6\",\n  \"private\": true,\n  \"description\": \"In memory storage persister for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-persister-in-memory.js\",\n  \"module\": \"dist/es/pollyjs-persister-in-memory.js\",\n  \"browser\": \"dist/umd/pollyjs-persister-in-memory.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-in-memory\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"persister\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"private\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/persister\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createNodeTestConfig(), createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/src/index.js",
    "content": "import Persister from '@pollyjs/persister';\n\nconst store = new Map();\n\nexport default class InMemoryPersister extends Persister {\n  static get id() {\n    return 'in-memory-persister';\n  }\n\n  onFindRecording(recordingId) {\n    return store.get(recordingId) || null;\n  }\n\n  onSaveRecording(recordingId, data) {\n    store.set(recordingId, data);\n  }\n\n  onDeleteRecording(recordingId) {\n    store.delete(recordingId);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-in-memory/types.d.ts",
    "content": "import Persister from '@pollyjs/persister';\n\nexport default class InMemoryPersister extends Persister {}\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/@pollyjs/persister-local-storage@1.0.4...@pollyjs/persister-local-storage@1.0.5) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/@pollyjs/persister-local-storage@1.0.3...@pollyjs/persister-local-storage@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/@pollyjs/persister-local-storage@1.0.2...@pollyjs/persister-local-storage@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/@pollyjs/persister-local-storage@1.0.1...@pollyjs/persister-local-storage@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage/compare/@pollyjs/persister-local-storage@1.0.0...@pollyjs/persister-local-storage@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-local-storage\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fpersister-local-storage.svg)](https://badge.fury.io/js/%40pollyjs%2Fpersister-local-storage)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/persister-local-storage` package provides a Local Storage\npersister that allows to read and write recordings to and from the browser's\nLocal Storage.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-local-storage -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-local-storage -D\n```\n\n## Documentation\n\nCheck out the [LocalStorage Persister](https://netflix.github.io/pollyjs/#/persisters/local-storage)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport LocalStoragePersister from '@pollyjs/persister-local-storage';\n\nPolly.register(LocalStoragePersister);\n\nnew Polly('<Recording Name>', {\n  persister: 'local-storage'\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/package.json",
    "content": "{\n  \"name\": \"@pollyjs/persister-local-storage\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Local storage persister for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-persister-local-storage.js\",\n  \"module\": \"dist/es/pollyjs-persister-local-storage.js\",\n  \"browser\": \"dist/umd/pollyjs-persister-local-storage.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-local-storage\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"local-storage\",\n    \"persister\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"build:watch\": \"yarn build -w\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/persister\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/rollup.config.test.js",
    "content": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default createBrowserTestConfig();\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/src/index.js",
    "content": "import Persister from '@pollyjs/persister';\n\nconst { parse } = JSON;\n\nexport default class LocalStoragePersister extends Persister {\n  static get id() {\n    return 'local-storage';\n  }\n\n  get defaultOptions() {\n    return {\n      key: 'pollyjs',\n      context: global\n    };\n  }\n\n  get localStorage() {\n    const { context } = this.options;\n\n    this.assert(\n      `Could not find \"localStorage\" on the given context \"${context}\".`,\n      context && context.localStorage\n    );\n\n    return context.localStorage;\n  }\n\n  get db() {\n    const items = this.localStorage.getItem(this.options.key);\n\n    return items ? parse(items) : {};\n  }\n\n  set db(db) {\n    this.localStorage.setItem(this.options.key, this.stringify(db));\n  }\n\n  onFindRecording(recordingId) {\n    return this.db[recordingId] || null;\n  }\n\n  onSaveRecording(recordingId, data) {\n    const { db } = this;\n\n    db[recordingId] = data;\n    this.db = db;\n  }\n\n  onDeleteRecording(recordingId) {\n    const { db } = this;\n\n    delete db[recordingId];\n    this.db = db;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-local-storage/types.d.ts",
    "content": "import Persister from '@pollyjs/persister';\n\nexport default class LocalStoragePersister extends Persister<{\n  context?: any;\n  key?: string;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [6.0.5](https://github.com/netflix/pollyjs/compare/v6.0.4...v6.0.5) (2022-04-04)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [6.0.4](https://github.com/netflix/pollyjs/compare/v6.0.3...v6.0.4) (2021-12-10)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [6.0.3](https://github.com/netflix/pollyjs/compare/v6.0.2...v6.0.3) (2021-12-08)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [6.0.2](https://github.com/netflix/pollyjs/compare/v6.0.1...v6.0.2) (2021-12-07)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* feat!: Cleanup adapter and persister APIs (#429) ([06499fc](https://github.com/netflix/pollyjs/commit/06499fc2d85254b3329db2bec770d173ed32bca0)), closes [#429](https://github.com/netflix/pollyjs/issues/429)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* - Adapter\n\t- `passthroughRequest` renamed to `onFetchResponse`\n\t- `respondToRequest` renamed to `onRespond`\n\n- Persister\n\t- `findRecording` renamed to `onFindRecording`\n\t- `saveRecording` renamed to `onSaveRecording`\n\t- `deleteRecording` renamed to `onDeleteRecording`\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [4.2.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.2.0...v4.2.1) (2020-04-30)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [4.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.0.3...v4.0.4) (2020-03-21)\n\n\n### Bug Fixes\n\n* Deprecates adapter & persister `name` in favor of `id` ([#310](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/issues/310)) ([41dd093](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/commit/41dd093))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/commit/5b4edf3))\n\n\n\n\n\n## [2.6.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.6.1...v2.6.2) (2019-08-05)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [2.6.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.6.0...v2.6.1) (2019-08-01)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/@pollyjs/persister-rest@1.0.4...@pollyjs/persister-rest@1.0.5) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.4\"></a>\n## [1.0.4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/@pollyjs/persister-rest@1.0.3...@pollyjs/persister-rest@1.0.4) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/@pollyjs/persister-rest@1.0.2...@pollyjs/persister-rest@1.0.3) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/@pollyjs/persister-rest@1.0.1...@pollyjs/persister-rest@1.0.2) (2018-08-09)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest/compare/@pollyjs/persister-rest@1.0.0...@pollyjs/persister-rest@1.0.1) (2018-07-26)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n\n<a name=\"1.0.0\"></a>\n# 1.0.0 (2018-07-20)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/persister-rest\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Fpersister-rest.svg)](https://badge.fury.io/js/%40pollyjs%2Fpersister-rest)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/persister-rest` package provides a REST API persister that allows\nto read and write recordings to and from the file system via a CRUD API hosted\non a server.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/persister-rest -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/persister-rest -D\n```\n\n## Documentation\n\nCheck out the [REST Persister](https://netflix.github.io/pollyjs/#/persisters/rest)\ndocumentation for more details.\n\n## Usage\n\n```js\nimport { Polly } from '@pollyjs/core';\nimport RESTPersister from '@pollyjs/persister-rest';\n\nPolly.register(RESTPersister);\n\nnew Polly('<Recording Name>', {\n  persister: 'rest'\n});\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/package.json",
    "content": "{\n  \"name\": \"@pollyjs/persister-rest\",\n  \"version\": \"6.0.6\",\n  \"description\": \"REST persister for @pollyjs\",\n  \"main\": \"dist/cjs/pollyjs-persister-rest.js\",\n  \"module\": \"dist/es/pollyjs-persister-rest.js\",\n  \"browser\": \"dist/umd/pollyjs-persister-rest.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-rest\",\n  \"license\": \"Apache-2.0\",\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"record\",\n    \"replay\",\n    \"rest\",\n    \"persister\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"dependencies\": {\n    \"@pollyjs/persister\": \"^6.0.6\",\n    \"@pollyjs/utils\": \"^6.0.6\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/rollup.config.test.js",
    "content": "import createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default createBrowserTestConfig();\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/src/ajax.js",
    "content": "const { keys } = Object;\nconst REQUEST_ASYNC =\n  !('navigator' in global) || !/PhantomJS/.test(global.navigator.userAgent);\nconst NativeXMLHttpRequest = global.XMLHttpRequest;\n\nexport default function ajax(url, options = {}) {\n  return new Promise((resolve, reject) => {\n    const xhr = new NativeXMLHttpRequest();\n\n    xhr.open(options.method || 'GET', url, REQUEST_ASYNC);\n\n    keys(options.headers || {}).forEach((k) =>\n      xhr.setRequestHeader(k, options.headers[k])\n    );\n\n    xhr.send(options.body);\n\n    if (REQUEST_ASYNC) {\n      xhr.onreadystatechange = () => {\n        if (xhr.readyState === NativeXMLHttpRequest.DONE) {\n          handleResponse(xhr, resolve, reject);\n        }\n      };\n\n      xhr.onerror = () => reject(xhr);\n    } else {\n      handleResponse(xhr, resolve, reject);\n    }\n  });\n}\n\nfunction handleResponse(xhr, resolve, reject) {\n  let body = xhr.response || xhr.responseText;\n\n  if (body && typeof body === 'string') {\n    try {\n      body = JSON.parse(body);\n    } catch (e) {\n      if (!(e instanceof SyntaxError)) {\n        console.error(e);\n      }\n    }\n  }\n\n  return xhr.status >= 200 && xhr.status < 300\n    ? resolve({ body, xhr })\n    : reject(xhr);\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/src/index.js",
    "content": "import Persister from '@pollyjs/persister';\nimport { buildUrl } from '@pollyjs/utils';\n\nimport ajax from './ajax';\n\nexport default class RestPersister extends Persister {\n  static get id() {\n    return 'rest';\n  }\n\n  get defaultOptions() {\n    return {\n      host: 'http://localhost:3000',\n      apiNamespace: '/polly'\n    };\n  }\n\n  ajax(url, ...args) {\n    const { host, apiNamespace } = this.options;\n\n    return ajax(buildUrl(host, apiNamespace, url), ...args);\n  }\n\n  async onFindRecording(recordingId) {\n    const response = await this.ajax(`/${encodeURIComponent(recordingId)}`, {\n      Accept: 'application/json; charset=utf-8'\n    });\n\n    return this._normalize(response);\n  }\n\n  async onSaveRecording(recordingId, data) {\n    await this.ajax(`/${encodeURIComponent(recordingId)}`, {\n      method: 'POST',\n      body: this.stringify(data),\n      headers: {\n        'Content-Type': 'application/json; charset=utf-8',\n        Accept: 'application/json; charset=utf-8'\n      }\n    });\n  }\n\n  async onDeleteRecording(recordingId) {\n    await this.ajax(`/${encodeURIComponent(recordingId)}`, {\n      method: 'DELETE'\n    });\n  }\n\n  _normalize({ xhr, body }) {\n    /**\n     * 204 - No Content. Polly uses this status code in place of 404\n     * when interacting with our Rest server to prevent throwing\n     * request errors in consumer's stdout (console.log)\n     */\n    if (xhr.status === 204) {\n      /* return null when a record was not found */\n      return null;\n    }\n\n    return body;\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/persister-rest/types.d.ts",
    "content": "import Persister from '@pollyjs/persister';\n\nexport default class RESTPersister extends Persister<{\n  host?: string;\n  apiNamespace?: string;\n}> {}\n"
  },
  {
    "path": "packages/@pollyjs/utils/CHANGELOG.md",
    "content": "# Change Log\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n## [6.0.6](https://github.com/netflix/pollyjs/compare/v6.0.5...v6.0.6) (2023-07-20)\n\n**Note:** Version bump only for package @pollyjs/utils\n\n\n\n\n\n## [6.0.1](https://github.com/netflix/pollyjs/compare/v6.0.0...v6.0.1) (2021-12-06)\n\n\n### Bug Fixes\n\n* **types:** add types.d.ts to package.files ([#431](https://github.com/netflix/pollyjs/issues/431)) ([113ee89](https://github.com/netflix/pollyjs/commit/113ee898bcf0467c5c48c15b53fc9198e2e91cb1))\n\n\n\n\n\n# [6.0.0](https://github.com/netflix/pollyjs/compare/v5.2.0...v6.0.0) (2021-11-30)\n\n\n* fix!: Upgrade url-parse (#426) ([c21ed04](https://github.com/netflix/pollyjs/commit/c21ed048ff9d87a3773458dcfb9758e4fa6582bf)), closes [#426](https://github.com/netflix/pollyjs/issues/426)\n* chore!: Upgrade package dependencies (#421) ([dd23334](https://github.com/netflix/pollyjs/commit/dd23334fa9b64248e4c49c3616237bdc2f12f682)), closes [#421](https://github.com/netflix/pollyjs/issues/421)\n* 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)\n* feat(ember)!: Upgrade to ember octane (#415) ([8559ef8](https://github.com/netflix/pollyjs/commit/8559ef8c600aefaec629870eac5f5c8953e18b16)), closes [#415](https://github.com/netflix/pollyjs/issues/415)\n\n\n### BREAKING CHANGES\n\n* Upgrade url-version to 1.5.0+ to fix CVE-2021-27515. This change could alter the final url generated for a request. \n* Recording file name will no longer have trailing dashes\n* 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.\n* @pollyjs dependencies have been moved to peer dependencies\n\n\n\n\n\n## [5.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v5.1.0...v5.1.1) (2021-06-02)\n\n\n### Bug Fixes\n\n* Handle failed arraybuffer instanceof checks ([#393](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/393)) ([247be0a](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/247be0a))\n\n\n\n\n\n# [5.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v4.3.0...v5.0.0) (2020-06-23)\n\n\n### Features\n\n* Remove deprecated Persister.name and Adapter.name ([#343](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/343)) ([1223ba0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/1223ba0))\n\n\n### BREAKING CHANGES\n\n* Persister.name and Adapter.name have been replaced with Persister.id and Adapter.id\n\n\n\n\n\n# [4.3.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v4.2.1...v4.3.0) (2020-05-18)\n\n\n### Features\n\n* **adapter-xhr:** Add support for handling binary data ([#333](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/333)) ([48ea1d7](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/48ea1d7))\n\n\n\n\n\n# [4.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v4.0.4...v4.1.0) (2020-04-23)\n\n\n### Bug Fixes\n\n* Legacy persisters and adapters should register ([#325](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/325)) ([8fd4d19](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/8fd4d19))\n\n\n\n\n\n## [4.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v4.0.1...v4.0.2) (2020-01-29)\n\n\n### Bug Fixes\n\n* **core:** Strict null query param handling ([#302](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/302)) ([5cf70aa](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/5cf70aa))\n\n\n\n\n\n# [4.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v3.0.2...v4.0.0) (2020-01-13)\n\n**Note:** Version bump only for package @pollyjs/utils\n\n\n\n\n\n# [3.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v2.7.0...v3.0.0) (2019-12-18)\n\n**Note:** Version bump only for package @pollyjs/utils\n\n\n\n\n\n## [2.6.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v2.6.2...v2.6.3) (2019-09-30)\n\n\n### Bug Fixes\n\n* use watch strategy ([#236](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/236)) ([5b4edf3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/5b4edf3))\n\n\n\n\n\n# [2.6.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v2.5.0...v2.6.0) (2019-07-17)\n\n\n### Features\n\n* PollyError and improved adapter error handling ([#234](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/234)) ([23a2127](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/23a2127))\n\n\n\n\n\n# [2.1.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v2.0.0...v2.1.0) (2019-02-04)\n\n**Note:** Version bump only for package @pollyjs/utils\n\n\n\n\n\n# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v1.4.2...v2.0.0) (2019-01-29)\n\n\n### Features\n\n* Make PollyRequest.respond accept a response object ([#168](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/168)) ([5b07b26](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/5b07b26))\n\n\n*  feat(adapter-node-http): Use `nock` under the hood instead of custom implementation (#166) ([62374f4](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/62374f4)), closes [#166](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/issues/166)\n\n\n### BREAKING CHANGES\n\n* The node-http adapter no longer accepts the `transports` option\n* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body).\n\n\n\n\n\n## [1.4.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v1.4.0...v1.4.1) (2018-12-13)\n\n\n### Bug Fixes\n\n* **utils:** Support arrays & nested objects in query params ([#148](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/148)) ([7e846b0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/7e846b0))\n\n\n\n\n\n## [1.3.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v1.3.1...v1.3.2) (2018-11-29)\n\n**Note:** Version bump only for package @pollyjs/utils\n\n\n\n\n\n## [1.3.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/v1.2.0...v1.3.1) (2018-11-28)\n\n\n### Features\n\n* **core:** Support custom functions in matchRequestsBy config options ([#138](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/138)) ([626a84c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/626a84c))\n* Add an onIdentifyRequest hook to allow adapter level serialization ([#140](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/140)) ([548002c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/548002c))\n\n\n\n\n\n<a name=\"1.2.0\"></a>\n# 1.2.0 (2018-09-16)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/53ad433))\n\n\n### Features\n\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/e622640))\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/8bb313c))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/f902c6d))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/@pollyjs/utils@1.0.2...@pollyjs/utils@1.0.3) (2018-08-22)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/utils\n\n<a name=\"1.0.2\"></a>\n## [1.0.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/@pollyjs/utils@1.0.1...@pollyjs/utils@1.0.2) (2018-08-12)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/utils\n\n<a name=\"1.0.1\"></a>\n## [1.0.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/@pollyjs/utils@1.0.0...@pollyjs/utils@1.0.1) (2018-08-12)\n\n\n### Bug Fixes\n\n* **adapter-puppeteer:** Do not intercept CORS preflight requests ([#90](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/90)) ([53ad433](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/53ad433))\n\n\n\n\n<a name=\"1.0.0\"></a>\n# [1.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/@pollyjs/utils@0.1.1...@pollyjs/utils@1.0.0) (2018-07-20)\n\n\n### Features\n\n* Convert recordings to be HAR compliant ([#45](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/45)) ([e622640](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/e622640))\n* Node File System Persister ([#61](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/61)) ([0a0eeca](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/0a0eeca))\n* Puppeteer Adapter ([#64](https://github.com/netflix/pollyjs/tree/master/packages/[@pollyjs](https://github.com/pollyjs)/utils/issues/64)) ([f902c6d](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/f902c6d))\n\n\n### BREAKING CHANGES\n\n* Recordings now produce HAR compliant json. Please delete existing recordings.\n\n\n\n\n<a name=\"0.1.1\"></a>\n## [0.1.1](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/compare/@pollyjs/utils@0.1.0...@pollyjs/utils@0.1.1) (2018-06-27)\n\n\n\n\n**Note:** Version bump only for package @pollyjs/utils\n\n<a name=\"0.1.0\"></a>\n# 0.1.0 (2018-06-16)\n\n\n### Features\n\n* Custom persister support ([8bb313c](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils/commit/8bb313c))\n"
  },
  {
    "path": "packages/@pollyjs/utils/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2018 Netflix Inc and @pollyjs contributors\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "packages/@pollyjs/utils/README.md",
    "content": "<p align=\"center\">\n  <img alt=\"Polly.JS\" width=\"400px\" src=\"https://netflix.github.io/pollyjs/assets/images/wordmark-logo-alt.png\" />\n</p>\n<h2 align=\"center\">Record, Replay, and Stub HTTP Interactions</h2>\n\n[![Build Status](https://travis-ci.com/Netflix/pollyjs.svg?branch=master)](https://travis-ci.com/Netflix/pollyjs)\n[![npm version](https://badge.fury.io/js/%40pollyjs%2Futils.svg)](https://badge.fury.io/js/%40pollyjs%2Futils)\n[![license](https://img.shields.io/github/license/Netflix/pollyjs.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe `@pollyjs/utils` package provides utilities and constants for other @pollyjs packages.\n\n## Installation\n\n_Note that you must have node (and npm) installed._\n\n```bash\nnpm install @pollyjs/utils -D\n```\n\nIf you want to install it with [yarn](https://yarnpkg.com):\n\n```bash\nyarn add @pollyjs/utils -D\n```\n\n## License\n\nCopyright (c) 2018 Netflix, Inc.\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n"
  },
  {
    "path": "packages/@pollyjs/utils/package.json",
    "content": "{\n  \"name\": \"@pollyjs/utils\",\n  \"version\": \"6.0.6\",\n  \"description\": \"Shared utilities and constants between @pollyjs packages\",\n  \"main\": \"dist/cjs/pollyjs-utils.js\",\n  \"module\": \"dist/es/pollyjs-utils.js\",\n  \"browser\": \"dist/umd/pollyjs-utils.js\",\n  \"types\": \"types.d.ts\",\n  \"files\": [\n    \"src\",\n    \"dist\",\n    \"types.d.ts\"\n  ],\n  \"repository\": \"https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils\",\n  \"scripts\": {\n    \"build\": \"rollup -c ../../../scripts/rollup/default.config.js\",\n    \"test:build\": \"rollup -c rollup.config.test.js\",\n    \"test:build:watch\": \"rollup -c rollup.config.test.js -w\",\n    \"build:watch\": \"yarn build -w\",\n    \"watch-all\": \"npm-run-all --parallel build:watch test:build:watch\"\n  },\n  \"keywords\": [\n    \"polly\",\n    \"pollyjs\",\n    \"utils\"\n  ],\n  \"publishConfig\": {\n    \"access\": \"public\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Jason Mitchell\",\n      \"email\": \"jason.mitchell.w@gmail.com\"\n    },\n    {\n      \"name\": \"Offir Golan\",\n      \"email\": \"offirgolan@gmail.com\"\n    }\n  ],\n  \"license\": \"Apache-2.0\",\n  \"dependencies\": {\n    \"qs\": \"^6.10.1\",\n    \"url-parse\": \"^1.5.3\"\n  },\n  \"devDependencies\": {\n    \"rollup\": \"^1.14.6\"\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/rollup.config.test.js",
    "content": "import createNodeTestConfig from '../../../scripts/rollup/node.test.config';\nimport createBrowserTestConfig from '../../../scripts/rollup/browser.test.config';\n\nexport default [createNodeTestConfig(), createBrowserTestConfig()];\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/constants/actions.js",
    "content": "export default {\n  RECORD: 'record',\n  REPLAY: 'replay',\n  INTERCEPT: 'intercept',\n  PASSTHROUGH: 'passthrough'\n};\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/constants/expiry-strategies.js",
    "content": "export default {\n  RECORD: 'record',\n  WARN: 'warn',\n  ERROR: 'error'\n};\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/constants/http-methods.js",
    "content": "export default [\n  'GET',\n  'PUT',\n  'POST',\n  'DELETE',\n  'PATCH',\n  'MERGE',\n  'HEAD',\n  'OPTIONS'\n];\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/constants/http-status-codes.js",
    "content": "export default {\n  100: 'Continue',\n  101: 'Switching Protocols',\n  200: 'OK',\n  201: 'Created',\n  202: 'Accepted',\n  203: 'Non-Authoritative Information',\n  204: 'No Content',\n  205: 'Reset Content',\n  206: 'Partial Content',\n  207: 'Multi-Status',\n  300: 'Multiple Choice',\n  301: 'Moved Permanently',\n  302: 'Found',\n  303: 'See Other',\n  304: 'Not Modified',\n  305: 'Use Proxy',\n  307: 'Temporary Redirect',\n  400: 'Bad Request',\n  401: 'Unauthorized',\n  402: 'Payment Required',\n  403: 'Forbidden',\n  404: 'Not Found',\n  405: 'Method Not Allowed',\n  406: 'Not Acceptable',\n  407: 'Proxy Authentication Required',\n  408: 'Request Timeout',\n  409: 'Conflict',\n  410: 'Gone',\n  411: 'Length Required',\n  412: 'Precondition Failed',\n  413: 'Request Entity Too Large',\n  414: 'Request-URI Too Long',\n  415: 'Unsupported Media Type',\n  416: 'Requested Range Not Satisfiable',\n  417: 'Expectation Failed',\n  422: 'Unprocessable Entity',\n  500: 'Internal Server Error',\n  501: 'Not Implemented',\n  502: 'Bad Gateway',\n  503: 'Service Unavailable',\n  504: 'Gateway Timeout',\n  505: 'HTTP Version Not Supported'\n};\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/constants/modes.js",
    "content": "export default {\n  RECORD: 'record',\n  REPLAY: 'replay',\n  PASSTHROUGH: 'passthrough',\n  STOPPED: 'stopped'\n};\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/index.js",
    "content": "export { default as MODES } from './constants/modes';\nexport { default as ACTIONS } from './constants/actions';\nexport { default as HTTP_METHODS } from './constants/http-methods';\nexport { default as HTTP_STATUS_CODES } from './constants/http-status-codes';\nexport { default as EXPIRY_STRATEGIES } from './constants/expiry-strategies';\n\nexport { default as assert } from './utils/assert';\nexport { default as timeout } from './utils/timeout';\nexport { default as timestamp } from './utils/timestamp';\nexport { default as buildUrl } from './utils/build-url';\n\nexport { default as PollyError } from './utils/polly-error';\nexport { default as Serializers } from './utils/serializers';\n\nexport { default as URL } from './utils/url';\n\nexport { default as isBufferUtf8Representable } from './utils/is-buffer-utf8-representable';\nexport { default as cloneArrayBuffer } from './utils/clone-arraybuffer';\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/assert.js",
    "content": "import PollyError from './polly-error';\n\nexport default function (msg, condition) {\n  if (!condition) {\n    throw new PollyError(msg);\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/build-url.js",
    "content": "import URL from './url';\n\nexport default function buildUrl(...paths) {\n  const url = new URL(\n    paths\n      .map((p) => p && (p + '').trim()) // Trim each string\n      .filter(Boolean) // Remove empty strings or other falsy paths\n      .join('/')\n  );\n\n  // Replace 2+ consecutive slashes with 1. (e.g. `///` --> `/`)\n  url.set('pathname', url.pathname.replace(/\\/{2,}/g, '/'));\n\n  return url.href;\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/clone-arraybuffer.js",
    "content": "/**\n * Clone an array buffer\n *\n * @param {ArrayBuffer} arrayBuffer\n */\nexport default function cloneArrayBuffer(arrayBuffer) {\n  const clonedArrayBuffer = new ArrayBuffer(arrayBuffer.byteLength);\n\n  new Uint8Array(clonedArrayBuffer).set(new Uint8Array(arrayBuffer));\n\n  return clonedArrayBuffer;\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/is-buffer-utf8-representable.js",
    "content": "import { Buffer } from 'buffer';\n\n/**\n * Determine if the given buffer is utf8.\n * @param {Buffer} buffer\n */\nexport default function isBufferUtf8Representable(buffer) {\n  const utfEncodedBuffer = buffer.toString('utf8');\n  const reconstructedBuffer = Buffer.from(utfEncodedBuffer, 'utf8');\n\n  return reconstructedBuffer.equals(buffer);\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/polly-error.js",
    "content": "export default class PollyError extends Error {\n  constructor(message, ...args) {\n    super(`[Polly] ${message}`, ...args);\n\n    // Maintains proper stack trace for where our error was thrown (only available on V8)\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, PollyError);\n    }\n\n    this.name = 'PollyError';\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/serializers/blob.js",
    "content": "export const supportsBlob = (() => {\n  try {\n    return !!new Blob();\n  } catch (e) {\n    return false;\n  }\n})();\n\nexport function readBlob(blob) {\n  return new Promise((resolve, reject) => {\n    const reader = new FileReader();\n\n    reader.onend = reject;\n    reader.onabort = reject;\n    reader.onload = () => resolve(reader.result);\n    reader.readAsDataURL(new Blob([blob], { type: blob.type }));\n  });\n}\n\nexport async function serialize(body) {\n  if (supportsBlob && body instanceof Blob) {\n    return await readBlob(body);\n  }\n\n  return body;\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/serializers/buffer.js",
    "content": "/* eslint-env node */\n\nexport const supportsBuffer = typeof Buffer !== 'undefined';\nexport const supportsArrayBuffer = typeof ArrayBuffer !== 'undefined';\n\nexport function serialize(body) {\n  if (supportsBuffer && body) {\n    let buffer;\n\n    if (Buffer.isBuffer(body)) {\n      buffer = body;\n    } else if (Array.isArray(body) && body.some((c) => Buffer.isBuffer(c))) {\n      // Body is a chunked array\n      const chunks = body.map((c) => Buffer.from(c));\n\n      buffer = Buffer.concat(chunks);\n    } else if (`${body}` === '[object ArrayBuffer]') {\n      buffer = Buffer.from(body);\n    } else if (supportsArrayBuffer && ArrayBuffer.isView(body)) {\n      buffer = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n    }\n\n    if (Buffer.isBuffer(buffer)) {\n      return buffer.toString('base64');\n    }\n  }\n\n  return body;\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/serializers/form-data.js",
    "content": "import { supportsBlob, readBlob } from './blob';\n\nexport const supportsFormData = typeof FormData !== 'undefined';\n\nexport async function serialize(body) {\n  if (supportsFormData && body instanceof FormData) {\n    const data = [];\n\n    for (const [key, value] of body.entries()) {\n      if (supportsBlob && value instanceof Blob) {\n        const blobContent = await readBlob(value);\n\n        data.push(`${key}=${blobContent}`);\n      } else {\n        data.push(`${key}=${value}`);\n      }\n    }\n\n    return data.join('\\r\\n');\n  }\n\n  return body;\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/serializers/index.js",
    "content": "import { serialize as blob } from './blob';\nimport { serialize as formData } from './form-data';\nimport { serialize as buffer } from './buffer';\n\nexport default { blob, formData, buffer };\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/timeout.js",
    "content": "export default function timeout(time) {\n  const ms = parseInt(time, 10);\n\n  return new Promise((resolve) =>\n    ms > 0 ? setTimeout(resolve, ms) : resolve()\n  );\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/timestamp.js",
    "content": "export default function timestamp() {\n  return new Date().toISOString();\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/src/utils/url.js",
    "content": "import URLParse from 'url-parse';\nimport qs from 'qs';\n\nconst ARRAY_FORMAT = Symbol();\nconst INDICES_REGEX = /\\[\\d+\\]$/;\nconst BRACKETS_REGEX = /\\[\\]$/;\n\nfunction parseQuery(query, options) {\n  return qs.parse(query, {\n    plainObjects: true,\n    ignoreQueryPrefix: true,\n    strictNullHandling: true,\n    ...options\n  });\n}\n\nfunction stringifyQuery(obj, options = {}) {\n  return qs.stringify(obj, {\n    addQueryPrefix: true,\n    strictNullHandling: true,\n    ...options\n  });\n}\n\n/**\n * Given a query string, determine the array format used. Returns `undefined`\n * if one cannot be determined.\n *\n * @param {String} query\n * @returns {String | undefined}\n */\nfunction arrayFormat(query) {\n  const keys = (query || '')\n    .replace('?', '')\n    .split('&')\n    .map((str) => decodeURIComponent(str.split('=')[0]));\n\n  for (const key of keys) {\n    if (INDICES_REGEX.test(key)) {\n      // a[0]=b&a[1]=c\n      return 'indices';\n    } else if (BRACKETS_REGEX.test(key)) {\n      // a[]=b&a[]=c\n      return 'brackets';\n    }\n  }\n\n  // Look to see if any key has a duplicate\n  const hasDuplicate = keys.some((key, index) => keys.indexOf(key) !== index);\n\n  if (hasDuplicate) {\n    // 'a=b&a=c'\n    return 'repeat';\n  }\n}\n\n/**\n * An extended url-parse class that uses `qs` instead of the default\n * `querystringify` to support array and nested object query param strings.\n */\nexport default class URL extends URLParse {\n  constructor(url, parse) {\n    // Construct the url with an un-parsed querystring\n    super(url);\n\n    if (parse) {\n      // If we want the querystring to be parsed, use this.set('query', query)\n      // as it will always parse the string. If there is no initial querystring\n      // pass an object which will act as the parsed query.\n      this.set('query', this.query || {});\n    }\n  }\n\n  /**\n   * Override set for `query` so we can pass it our custom parser.\n   * https://github.com/unshiftio/url-parse/blob/1.4.4/index.js#L314-L316\n   *\n   * @override\n   */\n  set(part, value, fn) {\n    if (part === 'query') {\n      if (value && typeof value === 'string') {\n        // Save the array format used so when we stringify it,\n        // we can use the correct format.\n        this[ARRAY_FORMAT] = arrayFormat(value) || this[ARRAY_FORMAT];\n      }\n\n      return super.set(part, value, parseQuery);\n    }\n\n    return super.set(part, value, fn);\n  }\n\n  /**\n   * Override toString so we can pass it our custom query stringify method.\n   * https://github.com/unshiftio/url-parse/blob/1.4.4/index.js#L414\n   *\n   * @override\n   */\n  toString() {\n    return super.toString((obj) =>\n      stringifyQuery(obj, { arrayFormat: this[ARRAY_FORMAT] })\n    );\n  }\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/browser/unit/utils/serializers/blob.js",
    "content": "import File from '@pollyjs-tests/helpers/file';\n\nimport { serialize } from '../../../../../src/utils/serializers/blob';\nimport serializerTests from '../../../../serializer-tests';\n\ndescribe('Unit | Utils | Serializers | blob', function () {\n  serializerTests(serialize);\n\n  it('should noop if Blob is not found', function () {\n    const Blob = Blob;\n    const blob = new Blob(['blob'], { type: 'text/plain' });\n\n    global.Blob = undefined;\n    expect(serialize(blob)).to.be.equal(blob);\n    global.Blob = Blob;\n  });\n\n  it('should handle blobs', async function () {\n    expect(\n      await serialize(new Blob(['blob'], { type: 'text/plain' }))\n    ).to.equal(`data:text/plain;base64,${btoa('blob')}`);\n  });\n\n  it('should handle files', async function () {\n    expect(\n      await serialize(\n        new File(['file'], 'file.txt', {\n          type: 'text/plain'\n        })\n      )\n    ).to.equal(`data:text/plain;base64,${btoa('file')}`);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/browser/unit/utils/serializers/form-data.js",
    "content": "import File from '@pollyjs-tests/helpers/file';\n\nimport { serialize } from '../../../../../src/utils/serializers/form-data';\nimport serializerTests from '../../../../serializer-tests';\n\ndescribe('Unit | Utils | Serializers | form-data', function () {\n  serializerTests(serialize);\n\n  it('should noop if FormData is not found', function () {\n    const FormData = FormData;\n    const formData = new FormData();\n\n    global.FormData = undefined;\n    expect(serialize(formData)).to.be.equal(formData);\n    global.FormData = FormData;\n  });\n\n  it('should handle form-data', async function () {\n    const formData = new FormData();\n\n    formData.append('string', 'string');\n    formData.append('array', [1, 2]);\n    formData.append('blob', new Blob(['blob'], { type: 'text/plain' }));\n    formData.append(\n      'file',\n      new File(['file'], 'file.txt', { type: 'text/plain' })\n    );\n\n    const data = await serialize(formData);\n\n    expect(data).to.include('string=string');\n    expect(data).to.include('array=1,2');\n    expect(data).to.include(`blob=data:text/plain;base64,${btoa('blob')}`);\n    expect(data).to.include(`file=data:text/plain;base64,${btoa('file')}`);\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/node/unit/utils/serializers/buffer.js",
    "content": "/* eslint-env node */\n\nimport { serialize } from '../../../../../src/utils/serializers/buffer';\nimport serializerTests from '../../../../serializer-tests';\n\ndescribe('Unit | Utils | Serializers | buffer', function () {\n  serializerTests(serialize);\n\n  it('should noop if Buffer is not found', function () {\n    const Buffer = Buffer;\n    const buffer = Buffer.from('buffer');\n\n    global.Buffer = undefined;\n    expect(serialize(buffer)).to.be.equal(buffer);\n    global.Buffer = Buffer;\n  });\n\n  it('should handle buffers', function () {\n    const buffer = Buffer.from('buffer');\n\n    expect(serialize(buffer)).to.equal(buffer.toString('base64'));\n  });\n\n  it('should handle array of buffers', function () {\n    const buffers = [Buffer.from('b1'), Buffer.from('b2')];\n\n    expect(serialize(buffers)).to.include(buffers[0].toString('base64'));\n    expect(serialize(buffers)).to.include(buffers[1].toString('base64'));\n  });\n\n  it('should handle a mixed array of buffers and strings', function () {\n    const buffers = [Buffer.from('b1'), 's1'];\n\n    expect(serialize(buffers)).to.include(buffers[0].toString('base64'));\n    expect(serialize(buffers)).to.include(\n      Buffer.from(buffers[1]).toString('base64')\n    );\n  });\n\n  it('should handle an ArrayBuffer', function () {\n    const buffer = new ArrayBuffer(8);\n\n    expect(serialize(buffer)).to.equal(Buffer.from(buffer).toString('base64'));\n  });\n\n  it('should handle an ArrayBufferView', function () {\n    const buffer = new Uint8Array(8);\n\n    expect(serialize(buffer)).to.equal(\n      Buffer.from(buffer, buffer.byteOffset, buffer.byteLength).toString(\n        'base64'\n      )\n    );\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/serializer-tests.js",
    "content": "export default function serializerTests(serialize) {\n  it('should exist', function () {\n    expect(serialize).to.be.a('function');\n  });\n\n  it('should handle empty argument', async function () {\n    expect(await serialize()).to.be.undefined;\n    expect(await serialize(null)).to.be.null;\n  });\n\n  it('should handle strings', async function () {\n    expect(await serialize('')).to.be.equal('');\n    expect(await serialize('foo')).to.be.equal('foo');\n  });\n}\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/assert-test.js",
    "content": "import assert from '../../../src/utils/assert';\nimport PollyError from '../../../src/utils/polly-error';\n\ndescribe('Unit | Utils | assert', function () {\n  it('should exist', function () {\n    expect(assert).to.be.a('function');\n  });\n\n  it('should throw with a false condition', function () {\n    expect(() => assert('Test', false)).to.throw(PollyError, /Test/);\n  });\n\n  it('should throw without a condition', function () {\n    expect(() => assert('Test')).to.throw(PollyError, /Test/);\n  });\n\n  it('should not throw with a true condition', function () {\n    expect(() => assert('Test', true)).to.not.throw();\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/build-url-test.js",
    "content": "import buildUrl from '../../../src/utils/build-url';\n\nconst origin = (global.location && global.location.origin) || '';\n\ndescribe('Unit | Utils | buildUrl', function () {\n  it('should exist', function () {\n    expect(buildUrl).to.be.a('function');\n  });\n\n  it('should remove consecutive slashes', function () {\n    expect(buildUrl('http://foo.com///bar/baz/')).to.equal(\n      'http://foo.com/bar/baz/'\n    );\n  });\n\n  it('should remove empty fragments of the url', function () {\n    expect(buildUrl('http://foo///bar/////baz')).to.equal('http://foo/bar/baz');\n  });\n\n  it('should remove empty fragments of the url', function () {\n    expect(buildUrl('/foo/bar/baz')).to.equal(`${origin}/foo/bar/baz`);\n  });\n\n  it('should concat multiple paths together', function () {\n    expect(buildUrl('/foo', '/bar', null, undefined, false, '/baz')).to.equal(\n      `${origin}/foo/bar/baz`\n    );\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/polly-error-test.js",
    "content": "import PollyError from '../../../src/utils/polly-error';\n\ndescribe('Unit | Utils | PollyError', function () {\n  it('should exist', function () {\n    expect(PollyError).to.be.a('function');\n  });\n\n  it('should set the name to PollyError', function () {\n    const error = new PollyError('Test');\n\n    expect(error.name).to.equal('PollyError');\n  });\n\n  it('should prefix the message with [Polly]', function () {\n    const error = new PollyError('Test');\n\n    expect(error.message).to.equal('[Polly] Test');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/timeout-test.js",
    "content": "import timeout from '../../../src/utils/timeout';\n\ndescribe('Unit | Utils | timeout', function () {\n  it('should exist', function () {\n    expect(timeout).to.be.a('function');\n  });\n\n  it('should return a promise', async function () {\n    const promise = timeout(10);\n\n    expect(promise).to.be.a('promise');\n\n    await promise;\n  });\n\n  it('should timeout for the correct amount of ms', async function () {\n    this.timeout(110);\n\n    const promise = timeout(100);\n    let resolved = false;\n\n    promise.then(() => (resolved = true));\n\n    setTimeout(() => expect(resolved).to.be.false, 50);\n    setTimeout(() => expect(resolved).to.be.true, 101);\n\n    await promise;\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/timestamp-test.js",
    "content": "import timestamp from '../../../src/utils/timestamp';\n\ndescribe('Unit | Utils | timestamp', function () {\n  it('should exist', function () {\n    expect(timestamp).to.be.a('function');\n  });\n\n  it('should return a string', function () {\n    expect(timestamp()).to.be.a('string');\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/tests/unit/utils/url-test.js",
    "content": "import URL from '../../../src/utils/url';\n\nconst encode = encodeURIComponent;\nconst decode = decodeURIComponent;\n\ndescribe('Unit | Utils | URL', function () {\n  it('should exist', function () {\n    expect(URL).to.be.a('function');\n  });\n\n  it('should work', function () {\n    expect(new URL('http://netflix.com/').href).to.equal('http://netflix.com/');\n  });\n\n  it('should should not parse the query string by default', function () {\n    expect(new URL('http://netflix.com/?foo=bar').query).to.equal('?foo=bar');\n  });\n\n  it('should correctly parse query params', function () {\n    [\n      ['', {}],\n      ['a&b=', { a: null, b: '' }],\n      ['foo=bar', { foo: 'bar' }],\n      ['a[]=1&a[]=2', { a: ['1', '2'] }],\n      ['a[1]=1&a[0]=2', { a: ['2', '1'] }],\n      ['a=1&a=2', { a: ['1', '2'] }],\n      ['foo[bar][baz]=1', { foo: { bar: { baz: '1' } } }]\n    ].forEach(([query, obj]) => {\n      expect(new URL(`http://foo.bar/?${query}`, true).query).to.deep.equal(\n        obj\n      );\n    });\n  });\n\n  it('should correctly stringify query params', function () {\n    [\n      // Query string will be undefined but we decode it in the assertion\n      [{}, decode(undefined)],\n      [{ a: null, b: '' }, 'a&b='],\n      [{ foo: 'bar' }, 'foo=bar'],\n      [{ a: ['1', '2'] }, 'a[0]=1&a[1]=2'],\n      [{ foo: { bar: { baz: '1' } } }, 'foo[bar][baz]=1']\n    ].forEach(([obj, query]) => {\n      const url = new URL('http://foo.bar', true);\n\n      url.set('query', obj);\n      expect(decode(url.href.split('?')[1])).to.equal(query);\n      expect(decode(url.toString().split('?')[1])).to.equal(query);\n    });\n  });\n\n  it('should correctly detect original array formats', function () {\n    [\n      'a[0]=1&a[1]=2',\n      `${encode('a[0]')}=1&${encode('a[1]')}=2`,\n      'a[]=1&a[]=2',\n      `${encode('a[]')}=1&${encode('a[]')}=2`,\n      'a=1&a=2'\n    ].forEach((query) => {\n      const url = new URL(`http://foo.bar/?${query}`, true);\n\n      expect(decode(url.href.split('?')[1])).to.equal(decode(query));\n      expect(decode(url.toString().split('?')[1])).to.equal(decode(query));\n    });\n  });\n\n  it('should correctly handle changes in array formats', function () {\n    const url = new URL(`http://foo.bar`, true);\n\n    ['a[0]=1&a[1]=2', 'a[]=1&a[]=2', 'a=1&a=2'].forEach((query) => {\n      url.set('query', query);\n\n      expect(decode(url.href.split('?')[1])).to.equal(query);\n      expect(decode(url.toString().split('?')[1])).to.equal(query);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/@pollyjs/utils/types.d.ts",
    "content": "export enum MODES {\n  RECORD = 'record',\n  REPLAY = 'replay',\n  PASSTHROUGH = 'passthrough',\n  STOPPED = 'stopped'\n}\n\nexport enum ACTIONS {\n  RECORD = 'record',\n  REPLAY = 'replay',\n  INTERCEPT = 'intercept',\n  PASSTHROUGH = 'passthrough'\n}\n\nexport enum EXPIRY_STRATEGIES {\n  RECORD = 'record',\n  WARN = 'warn',\n  ERROR = 'error'\n}\n"
  },
  {
    "path": "scripts/require-clean-work-tree.sh",
    "content": "#!/bin/bash\n\nrequire_clean_work_tree () {\n  git rev-parse --verify HEAD >/dev/null || exit 1\n  git update-index -q --ignore-submodules --refresh\n\n  # Disallow unstaged changes in the working tree\n  if ! git diff-files --quiet --ignore-submodules\n  then\n    echo \"There are unstaged changes.\"\n    git diff-files --name-status -r --ignore-submodules --\n    exit 1\n  fi\n\n  # Disallow uncommitted changes in the index\n  if ! git diff-index --cached --quiet --ignore-submodules HEAD --\n  then\n    echo \"The index contains uncommitted changes.\"\n    git diff-index --cached --name-status -r --ignore-submodules HEAD --\n    exit 1\n  fi\n}\n\nrequire_clean_work_tree\n"
  },
  {
    "path": "scripts/require-test-build.sh",
    "content": "#!/usr/bin/env bash\n\nif [ ! -f \"./packages/@pollyjs/node-server/dist/cjs/pollyjs-node-server.js\" ]; then\n  echo \"Test server build not found. Run either '$ yarn watch' or '$ yarn build:server'\"\n  exit 1\nfi\n\nif [ ! -f \"./packages/@pollyjs/core/dist/cjs/pollyjs-core.js\" ]; then\n  echo \"Build not found. Run either '$ yarn watch' or '$ yarn build'\"\n  exit 1\nfi\n\nif [ ! -f \"./packages/@pollyjs/core/build/node/test-bundle.cjs.js\" ]; then\n  echo \"Test build not found. Run either '$ yarn watch' or '$ yarn test:build'\"\n  exit 1\nfi\n"
  },
  {
    "path": "scripts/rollup/browser.config.js",
    "content": "import deepmerge from 'deepmerge';\nimport json from 'rollup-plugin-json';\nimport alias from 'rollup-plugin-alias';\nimport babel from 'rollup-plugin-babel';\nimport { terser } from 'rollup-plugin-terser';\nimport commonjs from 'rollup-plugin-commonjs';\nimport { rollup as lerna } from 'lerna-alias';\nimport resolve from 'rollup-plugin-node-resolve';\nimport globals from 'rollup-plugin-node-globals';\nimport builtins from 'rollup-plugin-node-builtins';\n\nimport { input, output, pkg, minify } from './utils';\n\nexport default function createBrowserConfig(options = {}, targets) {\n  return deepmerge(\n    {\n      input,\n      output: deepmerge(output('umd'), { name: pkg.name }),\n      plugins: [\n        alias(lerna()),\n        json(),\n        resolve({ browser: true, preferBuiltins: true }),\n        commonjs(),\n        babel({\n          babelrc: false,\n          runtimeHelpers: true,\n          exclude: ['../../../node_modules/**'],\n          presets: [\n            [\n              '@babel/preset-env',\n              {\n                modules: false,\n                targets: targets || {\n                  browsers: ['last 2 versions']\n                }\n              }\n            ]\n          ],\n          plugins: [\n            '@babel/plugin-external-helpers',\n            ['@babel/plugin-transform-runtime', { corejs: 2 }],\n            ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }]\n          ]\n        }),\n        globals(),\n        builtins(),\n        minify && terser()\n      ],\n      onwarn(message) {\n        /* nise uses eval for strings within native fns setTimeout('alert(\"foo\")', 10) */\n        if (/nise/.test(message) && /eval/.test(message)) {\n          return;\n        }\n\n        console.error(message);\n      }\n    },\n    options\n  );\n}\n"
  },
  {
    "path": "scripts/rollup/browser.test.config.js",
    "content": "import deepmerge from 'deepmerge';\nimport multiEntry from 'rollup-plugin-multi-entry';\nimport alias from 'rollup-plugin-alias';\n\nimport createBrowserConfig from './browser.config';\nimport { pkg, testsPath } from './utils';\n\nexport default function createBrowserTestConfig(options = {}) {\n  return deepmerge(\n    createBrowserConfig(\n      {\n        input: 'tests/!(node|jest)/**/*-test.js',\n        output: {\n          format: 'es',\n          name: `${pkg.name}-tests`,\n          file: `./build/browser/test-bundle.es.js`,\n          intro: `\n            'use strict'\n            describe('${pkg.name}', function() {\n          `,\n          outro: '});'\n        },\n        plugins: [alias({ '@pollyjs-tests': testsPath }), multiEntry()]\n      },\n      /* target override */\n      {\n        browsers: ['last 2 Chrome versions']\n      }\n    ),\n    options\n  );\n}\n"
  },
  {
    "path": "scripts/rollup/default.config.js",
    "content": "import createBrowserConfig from './browser.config';\nimport createNodeConfig from './node.config';\n\nexport default [createBrowserConfig(), createNodeConfig()];\n"
  },
  {
    "path": "scripts/rollup/jest.test.config.js",
    "content": "import deepmerge from 'deepmerge';\n\nimport createNodeTestConfig from './node.test.config';\nimport { pkg } from './utils';\n\nexport default function createJestTestConfig(options = {}) {\n  return deepmerge(\n    createNodeTestConfig({\n      input: 'tests/jest/**/*-test.js',\n      output: {\n        format: 'cjs',\n        name: `${pkg.name}-tests`,\n        file: `./build/jest/test-bundle.cjs.js`,\n        intro: `describe('${pkg.name}', function() {`,\n        outro: '});'\n      }\n    }),\n    options\n  );\n}\n"
  },
  {
    "path": "scripts/rollup/node.config.js",
    "content": "import deepmerge from 'deepmerge';\nimport json from 'rollup-plugin-json';\nimport babel from 'rollup-plugin-babel';\nimport { terser } from 'rollup-plugin-terser';\nimport commonjs from 'rollup-plugin-commonjs';\nimport resolve from 'rollup-plugin-node-resolve';\n\nimport { input, output, pkg, minify } from './utils';\n\nconst external = Object.keys(pkg.dependencies || {});\n\nexport default function createNodeConfig(options = {}) {\n  return deepmerge(\n    {\n      input,\n      output: [output('cjs'), output('es')],\n      external,\n      plugins: [\n        json(),\n        resolve({ preferBuiltins: true }),\n        commonjs(),\n        babel({\n          babelrc: false,\n          runtimeHelpers: true,\n          exclude: ['../../../node_modules/**'],\n          presets: [\n            [\n              '@babel/preset-env',\n              {\n                modules: false,\n                targets: {\n                  node: '12.0.0'\n                }\n              }\n            ]\n          ],\n          plugins: [\n            '@babel/plugin-external-helpers',\n            ['@babel/plugin-transform-runtime', { corejs: 2 }],\n            ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }]\n          ]\n        }),\n        minify && terser()\n      ]\n    },\n    options\n  );\n}\n"
  },
  {
    "path": "scripts/rollup/node.test.config.js",
    "content": "import deepmerge from 'deepmerge';\nimport multiEntry from 'rollup-plugin-multi-entry';\nimport alias from 'rollup-plugin-alias';\n\nimport createNodeConfig from './node.config';\nimport { pkg, testsPath } from './utils';\n\nconst pollyDependencies = Object.keys(pkg.devDependencies || {}).filter((d) =>\n  d.startsWith('@pollyjs')\n);\n\nexport default function createNodeTestConfig(options = {}) {\n  return deepmerge(\n    createNodeConfig({\n      input: 'tests/!(browser|jest)/**/*-test.js',\n      output: {\n        format: 'cjs',\n        name: `${pkg.name}-tests`,\n        file: `./build/node/test-bundle.cjs.js`,\n        intro: `describe('${pkg.name}', function() {`,\n        outro: '});'\n      },\n      plugins: [alias({ '@pollyjs-tests': testsPath }), multiEntry()],\n      external: [...pollyDependencies, 'node-fetch', 'chai']\n    }),\n    options\n  );\n}\n"
  },
  {
    "path": "scripts/rollup/utils.js",
    "content": "/* globals require process */\n\nimport path from 'path';\n\nexport const pkg = require(path.resolve(process.cwd(), './package.json'));\nexport const production = process.env.NODE_ENV === 'production';\nexport const minify = process.env.MINIFY === 'true';\n\nconst banner = `/**\n* ${pkg.name} v${pkg.version}\n*\n* https://github.com/netflix/pollyjs\n*\n* Released under the ${pkg.license} License.\n*/`;\n\nexport const input = './src/index.js';\nexport const output = (format) => {\n  return {\n    format,\n    file: `./dist/${format}/${pkg.name.replace('@pollyjs/', 'pollyjs-')}.${\n      minify ? 'min.js' : 'js'\n    }`,\n    sourcemap: production,\n    banner\n  };\n};\n\nexport const testsPath = path.resolve(process.cwd(), '../../../tests');\n"
  },
  {
    "path": "testem.js",
    "content": "/* eslint-env node */\nconst attachMiddleware = require('./tests/middleware');\n\nmodule.exports = {\n  port: 4000,\n  fail_on_zero_tests: true,\n  test_page: 'tests/index.mustache',\n  launch_in_ci: ['Chrome', 'Node', 'Jest', 'Ember', 'ESLint'],\n  launch_in_dev: ['Chrome', 'Node', 'Jest', 'Ember', 'ESLint'],\n  watch_files: [\n    './scripts/rollup/*',\n    './packages/@pollyjs/*/build/**/*',\n    './packages/@pollyjs/*/dist/**/*'\n  ],\n  serve_files: ['./packages/@pollyjs/*/build/browser/*.js'],\n  browser_args: {\n    Chrome: {\n      ci: [\n        // --no-sandbox is needed when running Chrome inside a container\n        process.env.CI ? '--no-sandbox' : null,\n        '--headless',\n        '--disable-gpu',\n        '--disable-dev-shm-usage',\n        '--disable-software-rasterizer',\n        '--mute-audio',\n        '--remote-debugging-port=0',\n        '--window-size=1440,900'\n      ].filter(Boolean)\n    }\n  },\n  middleware: [attachMiddleware],\n  launchers: {\n    'Node:debug': {\n      command: 'mocha --inspect-brk'\n    },\n    Node: {\n      command: 'mocha --reporter tap',\n      protocol: 'tap'\n    },\n    Jest: {\n      command: 'jest',\n      protocol: 'tap'\n    },\n    Ember: {\n      command: 'yarn workspace @pollyjs/ember run test',\n      protocol: 'tap'\n    },\n    ESLint: {\n      command: 'yarn lint --format tap',\n      protocol: 'tap'\n    }\n  }\n};\n"
  },
  {
    "path": "tests/helpers/file.js",
    "content": "/**\n * Special thanks to the FormData project.\n * Full credit: https://github.com/jimmywarting/FormData (MIT)\n */\n\nconst { defineProperties, defineProperty } = Object;\nconst stringTag = Symbol && Symbol.toStringTag;\n\nlet _File;\n\ntry {\n  new File([], '');\n  _File = File;\n} catch (e) {\n  /**\n   * @see http://www.w3.org/TR/FileAPI/#dfn-file\n   * @param {!Array<string|!Blob|!ArrayBuffer>=} chunks\n   * @param {string=} filename\n   * @param {{type: (string|undefined), lastModified: (number|undefined)}=}\n   *     opts\n   * @constructor\n   * @extends {Blob}\n   */\n  _File = function File(chunks, filename, opts = {}) {\n    const _this = new Blob(chunks, opts);\n    const modified =\n      opts && opts.lastModified !== undefined\n        ? new Date(opts.lastModified)\n        : new Date();\n\n    defineProperties(_this, {\n      name: {\n        value: filename\n      },\n      lastModifiedDate: {\n        value: modified\n      },\n      lastModified: {\n        value: +modified\n      },\n      toString: {\n        value() {\n          return '[object File]';\n        }\n      }\n    });\n\n    if (stringTag) {\n      defineProperty(_this, Symbol.toStringTag, {\n        value: 'File'\n      });\n    }\n\n    return _this;\n  };\n}\n\nexport default _File;\n"
  },
  {
    "path": "tests/helpers/global-node-fetch.js",
    "content": "import fetch, { Response, Request, Headers } from 'node-fetch';\n\nglobal.fetch = fetch;\nglobal.Request = Request;\nglobal.Response = Response;\nglobal.Headers = Headers;\n"
  },
  {
    "path": "tests/helpers/setup-fetch-record.js",
    "content": "const defaultOptions = {\n  host: '',\n  fetch() {\n    return global.fetch(...arguments);\n  }\n};\n\nfunction setupFetchRecord(options) {\n  setupFetchRecord.beforeEach(options);\n  setupFetchRecord.afterEach();\n}\n\nsetupFetchRecord.beforeEach = function (options = {}) {\n  options = { ...defaultOptions, ...options };\n\n  beforeEach(function () {\n    const { host, fetch } = options;\n\n    this.fetch = fetch;\n\n    this.relativeFetch = (url, options) => this.fetch(`${host}${url}`, options);\n\n    this.recordUrl = () =>\n      `${host}/api/db/${encodeURIComponent(this.polly.recordingId)}`;\n\n    this.fetchRecord = (...args) => this.fetch(this.recordUrl(), ...args);\n  });\n};\n\nsetupFetchRecord.afterEach = function () {\n  afterEach(async function () {\n    // Note: test setup could fail, so we cannot assume this.polly\n    // was setup before accessing it.\n    if (this.polly) {\n      this.polly.pause();\n      await this.fetchRecord({ method: 'DELETE' });\n      this.polly.play();\n    }\n  });\n};\n\nexport default setupFetchRecord;\n"
  },
  {
    "path": "tests/helpers/setup-persister.js",
    "content": "function setupPersister() {\n  setupPersister.beforeEach();\n  setupPersister.afterEach();\n}\n\nsetupPersister.beforeEach = function () {};\n\nsetupPersister.afterEach = function () {\n  afterEach(async function () {\n    await this.polly.persister.deleteRecording(this.polly.recordingId);\n  });\n};\n\nexport default setupPersister;\n"
  },
  {
    "path": "tests/index.mustache",
    "content": "<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Polly.JS Tests</title>\n    <link rel=\"icon\" href=\"../docs/assets/images/favicon.ico\" type=\"image/x-icon\">\n    <link href=\"../node_modules/mocha/mocha.css\" rel=\"stylesheet\"/>\n    {{#css_files}}\n      <link rel=\"stylesheet\" href=\"{{src}}\">\n    {{/css_files}}\n  </head>\n  <body>\n    <div id=\"mocha\"></div>\n\n    <script src=\"../node_modules/chai/chai.js\"></script>\n    <script src=\"../node_modules/mocha/mocha.js\"></script>\n    <script src=\"/testem.js\"></script>\n\n    <script>\n      window.expect = window.chai.expect;\n      mocha.setup({ ui: 'bdd', noHighlighting: true });\n    </script>\n\n\n    {{#serve_files}}\n      <script src=\"../{{src}}\"></script>\n    {{/serve_files}}\n\n    <script>\n        mocha.checkLeaks();\n        mocha.globals([\n          /**\n           * The following globals are inserted by Internet Explorer's developer tools.\n           * IE injects these into the running context for debugging purposes.\n           * This confuses mocha as it thinks it's observed a memory leak between runs.\n           */\n          '$0', '$1', '$2', '$3', '$4', '$_', '__BROWSERTOOLS_DOMEXPLORER_ADDED'\n        ]);\n        mocha.run();\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "tests/integration/adapter-browser-tests.js",
    "content": "import 'formdata-polyfill';\nimport File from '../helpers/file';\n\nexport default function adapterBrowserTests() {\n  it('should handle recording requests posting FormData + Blob/File', async function () {\n    const { server, recordingName } = this.polly;\n    const form = new FormData();\n\n    form.append('string', recordingName);\n    form.append('array', [recordingName, recordingName]);\n    form.append('blob', new Blob([recordingName], { type: 'text/plain' }));\n    form.append(\n      'file',\n      new File([recordingName], 'test.txt', { type: 'text/plain' })\n    );\n\n    server.post('/submit').intercept((req, res) => {\n      const body = req.identifiers.body;\n\n      // Make sure the form data exists in the identifiers\n      expect(body).to.include(recordingName);\n\n      expect(body).to.include(`string=${recordingName}`);\n      expect(body).to.include(\n        `array=${[recordingName, recordingName].toString()}`\n      );\n      expect(body).to.include(\n        `blob=data:text/plain;base64,${btoa(recordingName)}`\n      );\n\n      expect(body).to.include(\n        `file=data:text/plain;base64,${btoa(recordingName)}`\n      );\n\n      res.sendStatus(200);\n    });\n\n    const res = await this.fetch('/submit', { method: 'POST', body: form });\n\n    expect(res.status).to.equal(200);\n  });\n\n  it('should handle recording requests posting a Blob', async function () {\n    const { server, recordingName } = this.polly;\n\n    server.post('/submit').intercept((req, res) => {\n      const dataUrl = `data:text/plain;base64,${btoa(recordingName)}`;\n\n      // Make sure the form data exists in the identifiers\n      expect(req.identifiers.body).to.equal(dataUrl);\n\n      res.sendStatus(200);\n    });\n\n    const res = await this.fetch('/submit', {\n      method: 'POST',\n      body: new Blob([recordingName], { type: 'text/plain' })\n    });\n\n    expect(res.status).to.equal(200);\n  });\n}\n"
  },
  {
    "path": "tests/integration/adapter-identifier-tests.js",
    "content": "import set from 'lodash-es/set';\nimport deepmerge from 'deepmerge';\n\nfunction adapterIdentifierTests() {\n  describe('matchRequestsBy', function () {\n    beforeEach(function () {\n      const { polly } = this;\n\n      polly.server.post('/*').intercept((req, res) => {\n        res.sendStatus(200);\n      });\n\n      this.requests = captureRequests(polly.server);\n    });\n\n    testConfiguration('method', false, {\n      expected: {\n        id: 'e7e58325a54088ab228cd9dbe7558141',\n        identifiers: {\n          headers: { 'content-type': 'application/json;charset=utf-8' },\n          body: '{}',\n          url: 'http://localhost:4000/pathname?query=param'\n        }\n      },\n      overrides: {\n        'node-http': {\n          id: '815b91955669771aa83a74ca27f6fbd8',\n          identifiers: {\n            headers: {\n              host: 'localhost:4000'\n            }\n          }\n        }\n      }\n    });\n\n    testConfiguration('headers', false, {\n      expected: {\n        id: '74e48a0f5e33321aa1aa3f4f65c8ccde',\n        identifiers: {\n          method: 'POST',\n          body: '{}',\n          url: 'http://localhost:4000/pathname?query=param'\n        }\n      }\n    });\n\n    testConfiguration('body', false, {\n      expected: {\n        id: 'b0427f53912c03a68ea2d4e923e136a8',\n        identifiers: {\n          body: undefined,\n          headers: { 'content-type': 'application/json;charset=utf-8' },\n          method: 'POST',\n          url: 'http://localhost:4000/pathname?query=param'\n        }\n      },\n      overrides: {\n        'node-http': {\n          id: 'b58187c060d6d9e8605dc0d2e68a4cc4',\n          identifiers: {\n            headers: {\n              host: 'localhost:4000'\n            }\n          }\n        }\n      }\n    });\n\n    testConfiguration('order', true, {\n      expected: {\n        id: '3dbff3c3fbccd6f97d01be31fc7fdd59',\n        identifiers: {\n          headers: { 'content-type': 'application/json;charset=utf-8' },\n          method: 'POST',\n          body: '{}',\n          url: 'http://localhost:4000/pathname?query=param'\n        }\n      },\n      overrides: {\n        'node-http': {\n          id: 'd0b5dfe199e75e370366c7570e402283',\n          identifiers: {\n            headers: {\n              host: 'localhost:4000'\n            }\n          }\n        }\n      }\n    });\n\n    describe('url', function () {\n      testConfiguration('url', false, {\n        expected: {\n          id: '3914e0be4d2f04139554f5ffada7191c',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: 'ecc7560697b752deb2529686affcaa71',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.protocol', false, {\n        expected: {\n          id: '79224baf23dc29f8115516cb8fe0546f',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: '//localhost:4000/pathname?query=param'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: 'c24a09e0bd482ecafea2e6a523a2300c',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.hostname', false, {\n        expected: {\n          id: 'e5afacdff75fdbbdee298c4114fe576a',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: 'http://:4000/pathname?query=param'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: '754af334c21a6367de2f4a96a88b500c',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.pathname', false, {\n        expected: {\n          id: 'bb2e8915ffeb6618c7095355ff16d141',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: 'http://localhost:4000?query=param'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: '3575605055acca2b0d49f70fad6a8ea3',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.port', false, {\n        expected: {\n          id: '97705c56f6fc0e59027bef42d87902c3',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: 'http://localhost/pathname?query=param'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: 'fe9e1be1fbde1268cf010cc0003736cb',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.query', false, {\n        expected: {\n          id: '534d71c078b3e446198b5060a560f900',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: 'http://localhost:4000/pathname'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: '87788eaf035ab979bdd49cf2b4ff43f1',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n\n      testConfiguration('url.hash', true, {\n        expected: {\n          id: '80d27c6c94767915e1ac5db46896820e',\n          identifiers: {\n            headers: { 'content-type': 'application/json;charset=utf-8' },\n            method: 'POST',\n            body: '{}',\n            url: 'http://localhost:4000/pathname?query=param#abc'\n          }\n        },\n        overrides: {\n          'node-http': {\n            id: 'd876bcf1151b72a1b1bdf2a88403d6b3',\n            identifiers: {\n              headers: {\n                host: 'localhost:4000'\n              }\n            }\n          }\n        }\n      });\n    });\n  });\n}\n\nfunction captureRequests(server) {\n  const reqs = [];\n\n  server.any().on('request', (req) => reqs.push(req));\n\n  return reqs;\n}\n\nfunction lookupAdapterName(polly) {\n  return [...polly.adapters.keys()][0];\n}\n\nfunction testConfiguration(optionName, value, expectedValues) {\n  it(`${optionName}=${value}`, async function () {\n    const adapterName = lookupAdapterName(this.polly);\n    const expectedValue = deepmerge(\n      expectedValues.expected || {},\n      (expectedValues.overrides && expectedValues.overrides[adapterName]) || {}\n    );\n\n    const matchRequestsBy = set({}, optionName, value);\n\n    this.polly.configure({\n      matchRequestsBy\n    });\n\n    await this.fetch('http://localhost:4000/pathname?query=param#abc', {\n      method: 'POST',\n      body: JSON.stringify({}),\n      headers: { 'content-type': 'application/json;charset=utf-8' }\n    });\n\n    const [targetRequest] = this.requests;\n\n    if (targetRequest.identifiers) {\n      expect(targetRequest.identifiers).to.deep.equal(\n        expectedValue.identifiers\n      );\n    }\n\n    expect(targetRequest.id).to.equal(expectedValue.id);\n  });\n}\n\nexport default adapterIdentifierTests;\n"
  },
  {
    "path": "tests/integration/adapter-node-tests.js",
    "content": "/* eslint-env node */\n\nexport default function adapterNodeTests() {\n  it('should handle recording requests posting a Buffer', async function () {\n    const { server, recordingName } = this.polly;\n    const buffer = Buffer.from(recordingName);\n    const url = `http://example.com/upload`;\n\n    server.post(url).intercept((req, res) => {\n      const body = req.identifiers.body;\n\n      // Make sure the buffer exists in the identifiers\n      expect(body).to.include(buffer.toString());\n\n      res.sendStatus(200);\n    });\n\n    const res = await this.fetch(url, { method: 'POST', body: buffer });\n\n    expect(res.status).to.equal(200);\n  });\n\n  it('should handle recording requests posting an ArrayBuffer', async function () {\n    const { server } = this.polly;\n    const buffer = new ArrayBuffer(8);\n    const url = `http://example.com/upload`;\n\n    server.post(url).intercept((req, res) => {\n      const body = req.identifiers.body;\n\n      // Make sure the buffer exists in the identifiers\n      expect(body).to.include(Buffer.from(buffer).toString());\n\n      res.sendStatus(200);\n    });\n\n    const res = await this.fetch(url, { method: 'POST', body: buffer });\n\n    expect(res.status).to.equal(200);\n  });\n}\n"
  },
  {
    "path": "tests/integration/adapter-polly-tests.js",
    "content": "export default function pollyTests() {\n  it('should not handle any requests when paused', async function () {\n    const { server } = this.polly;\n    const requests = [];\n\n    server.any().on('request', (req) => requests.push(req));\n\n    await this.fetchRecord();\n    await this.fetchRecord();\n\n    this.polly.pause();\n    await this.fetchRecord();\n    await this.fetchRecord();\n\n    this.polly.play();\n    await this.fetchRecord();\n\n    expect(requests.length).to.equal(3);\n    expect(this.polly._requests.length).to.equal(3);\n    expect(requests.map((r) => r.order)).to.deep.equal([0, 1, 2]);\n  });\n}\n"
  },
  {
    "path": "tests/integration/adapter-tests.js",
    "content": "import { Polly } from '@pollyjs/core';\nimport { ACTIONS } from '@pollyjs/utils';\n\nexport default function adapterTests() {\n  it('should respect request order', async function () {\n    const testOrder = async () => {\n      let res = await this.fetchRecord();\n\n      expect(res.status).to.equal(404);\n\n      res = await this.fetchRecord({\n        method: 'POST',\n        body: JSON.stringify({ foo: 'bar' }),\n        headers: { 'Content-Type': 'application/json' }\n      });\n\n      expect(res.status).to.equal(200);\n\n      res = await this.fetchRecord();\n      const json = await res.json();\n\n      expect(json).to.deep.equal({ foo: 'bar' });\n\n      res = await this.fetchRecord({ method: 'DELETE' });\n      expect(res.status).to.equal(200);\n\n      res = await this.fetchRecord();\n      expect(res.status).to.equal(404);\n    };\n\n    this.polly.configure({ recordIfMissing: false });\n\n    const { recordingName, config } = this.polly;\n\n    this.polly.record();\n    await testOrder();\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    this.polly.replay();\n    await testOrder();\n  });\n\n  it('should respect request order across multiple recordings', async function () {\n    const recordingName = this.polly.recordingName;\n    const otherRecordingName = `${this.polly.recordingName}-other`;\n    const order = {\n      [recordingName]: [],\n      [otherRecordingName]: []\n    };\n\n    this.polly.server.any(this.recordUrl()).on('beforeResponse', (req) => {\n      order[req.recordingName].push(req.order);\n    });\n\n    await this.fetchRecord();\n    await this.fetchRecord();\n\n    this.polly.server.any(this.recordUrl()).recordingName(otherRecordingName);\n    await this.fetchRecord();\n    await this.fetchRecord();\n\n    this.polly.server.any(this.recordUrl()).recordingName();\n    await this.fetchRecord();\n\n    expect(order[recordingName]).to.have.ordered.members([0, 1, 2]);\n    expect(order[otherRecordingName]).to.have.ordered.members([0, 1]);\n  });\n\n  it('should properly handle 204 status code response', async function () {\n    const res = await this.relativeFetch('/echo?status=204');\n\n    expect(res.status).to.equal(204);\n    expect(await res.text()).to.equal('');\n  });\n\n  it('should intercept', async function () {\n    const { server } = this.polly;\n\n    server.any(this.recordUrl()).intercept((_, res) => res.status(201));\n\n    server.get(this.recordUrl()).intercept((req, res) => res.json(req.query));\n\n    const res = await this.fetch(`${this.recordUrl()}?foo=bar`);\n    const json = await res.json();\n\n    expect(res.status).to.equal(201);\n    expect(json).to.deep.equal({ foo: 'bar' });\n  });\n\n  it('should passthrough', async function () {\n    const { server, persister, recordingId } = this.polly;\n\n    server.get(this.recordUrl()).passthrough();\n\n    expect(await persister.findRecording(recordingId)).to.be.null;\n    expect((await this.fetchRecord()).status).to.equal(404);\n    expect(await persister.findRecording(recordingId)).to.be.null;\n  });\n\n  it('should be able to intercept when in passthrough mode', async function () {\n    const { server } = this.polly;\n\n    this.polly.configure({ mode: 'passthrough' });\n\n    server\n      .get(this.recordUrl())\n      .intercept((req, res) => res.status(200).send('Hello'));\n\n    const res = await this.fetchRecord();\n    const text = await res.text();\n\n    expect(res.status).to.equal(200);\n    expect(text).to.equal('Hello');\n  });\n\n  it('should be able to abort from an intercept', async function () {\n    const { server } = this.polly;\n    let responseCalled = false;\n\n    server\n      .get(this.recordUrl())\n      .intercept((req, res, interceptor) => interceptor.abort())\n      .on('response', (req) => {\n        responseCalled = true;\n        expect(req.action).to.not.equal(ACTIONS.INTERCEPT);\n      });\n\n    expect((await this.fetchRecord()).status).to.equal(404);\n    expect(responseCalled).to.be.true;\n  });\n\n  it('should be able to passthrough from an intercept', async function () {\n    const { server, persister, recordingId } = this.polly;\n    let responseCalled = false;\n\n    server\n      .get(this.recordUrl())\n      .intercept((req, res, interceptor) => interceptor.passthrough())\n      .on('response', (req) => {\n        responseCalled = true;\n        expect(req.action).to.equal(ACTIONS.PASSTHROUGH);\n      });\n\n    expect(await persister.findRecording(recordingId)).to.be.null;\n    expect((await this.fetchRecord()).status).to.equal(404);\n    expect(await persister.findRecording(recordingId)).to.be.null;\n    expect(responseCalled).to.be.true;\n  });\n\n  it('should call all the life-cycle events', async function () {\n    const { server } = this.polly;\n    const events = [];\n\n    server\n      .get(this.recordUrl())\n      .on('request', () => events.push('request'))\n      .on('beforeResponse', () => events.push('beforeResponse'))\n      .on('response', () => events.push('response'));\n\n    await this.fetchRecord();\n\n    expect(events).to.have.ordered.members([\n      'request',\n      'beforeResponse',\n      'response'\n    ]);\n  });\n\n  it('should call beforeReplay with a cloned recording entry', async function () {\n    const { recordingId, recordingName, config } = this.polly;\n    let replayedEntry;\n\n    this.polly.record();\n    await this.fetchRecord();\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    this.polly.replay();\n\n    const har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(1);\n\n    this.polly.server\n      .get(this.recordUrl())\n      .on('beforeReplay', (_req, entry) => (replayedEntry = entry));\n\n    const entry = har.log.entries[0];\n\n    await this.fetchRecord();\n\n    expect(replayedEntry).to.be.an('object');\n\n    expect(entry).to.deep.equal(replayedEntry);\n    expect(entry).to.not.equal(replayedEntry);\n\n    expect(entry.request).to.deep.equal(replayedEntry.request);\n    expect(entry.request).to.not.equal(replayedEntry.request);\n\n    expect(entry.response).to.deep.equal(replayedEntry.response);\n    expect(entry.response).to.not.equal(replayedEntry.response);\n\n    expect(entry.response.content).to.deep.equal(\n      replayedEntry.response.content\n    );\n    expect(entry.response.content).to.not.equal(replayedEntry.response.content);\n  });\n\n  it('should emit an error event', async function () {\n    const { server } = this.polly;\n    let error;\n\n    this.polly.configure({ recordIfMissing: false });\n\n    server.get(this.recordUrl()).on('error', (req, err) => (error = err));\n\n    try {\n      await this.fetchRecord();\n    } catch (e) {\n      /* noop */\n    }\n\n    expect(error).to.exist;\n    expect(error.message).to.match(\n      /Recording for the following request is not found/\n    );\n  });\n\n  it('should handle a compressed response', async function () {\n    const res = await this.relativeFetch('/compress', {\n      method: 'POST',\n      body: JSON.stringify({ foo: 'bar' }),\n      headers: { 'Content-Type': 'application/json' }\n    });\n\n    expect(res.status).to.equal(200);\n    expect(await res.json()).to.deep.equal({ foo: 'bar' });\n  });\n\n  it('should have resolved requests after flushing', async function () {\n    // The puppeteer adapter has its own implementation of this test\n    if (this.polly.adapters.has('puppeteer')) {\n      this.skip();\n    }\n\n    const { server } = this.polly;\n    const requests = [];\n    const resolved = [];\n\n    server\n      .get(this.recordUrl())\n      .intercept(async (req, res) => {\n        await server.timeout(5);\n        res.sendStatus(200);\n      })\n      .on('request', (req) => {\n        requests.push(req);\n      });\n\n    this.fetchRecord().then(() => resolved.push(1));\n    this.fetchRecord().then(() => resolved.push(2));\n    this.fetchRecord().then(() => resolved.push(3));\n\n    await this.polly.server.timeout(10);\n\n    expect(requests).to.have.lengthOf(3);\n\n    await this.polly.flush();\n\n    requests.forEach((request) => expect(request.didRespond).to.be.true);\n    expect(resolved).to.have.members([1, 2, 3]);\n  });\n\n  // NOTE: test very unstable because of typicode.com being down\n  it.skip('should work with CORS requests', async function () {\n    this.timeout(10000);\n\n    const { server } = this.polly;\n    const apiUrl = 'http://jsonplaceholder.typicode.com';\n\n    server.any(`${apiUrl}/*`).passthrough();\n\n    let res = await this.fetch(`${apiUrl}/posts/1`);\n\n    expect(res.ok).to.be.true;\n    expect(await res.json()).to.be.an('object');\n\n    res = await this.fetch(`${apiUrl}/posts`, {\n      method: 'POST',\n      body: JSON.stringify({ foo: 'bar' }),\n      headers: { 'Content-Type': 'application/json' }\n    });\n\n    expect(res.ok).to.be.true;\n  });\n\n  describe('Expiration', () => {\n    async function testExpiration() {\n      const { persister, recordingId } = this.polly;\n      const url = '/api';\n      let har;\n\n      // request number one - records the request\n      this.polly.record();\n      await this.relativeFetch(url);\n      await persister.persist();\n      har = await persister.findRecording(recordingId);\n\n      expect(har).to.be.an('object');\n      expect(har.log.entries).to.have.lengthOf(1);\n      const prevDateTime = har.log.entries[0].startedDateTime;\n\n      // wait for the first request to expire\n      await new Promise((r) => setTimeout(r, 10));\n\n      // request number two - the first request is now expired\n      this.polly.replay();\n      await this.relativeFetch(url);\n      await persister.persist();\n      har = await persister.findRecording(recordingId);\n\n      expect(har).to.be.an('object');\n      expect(har.log.entries).to.have.lengthOf(1);\n      const nextDateTime = har.log.entries[0].startedDateTime;\n\n      // boolean returned is true if re-record occurred\n      return prevDateTime !== nextDateTime;\n    }\n\n    beforeEach(function () {\n      this.polly.configure({\n        expiresIn: '1ms',\n        matchRequestsBy: {\n          order: false\n        }\n      });\n    });\n\n    afterEach(async function () {\n      await this.polly.persister.deleteRecording(this.polly.recordingId);\n    });\n\n    it('warns and plays back on expired recording if expiryStrategy is \"warn\"', async function () {\n      this.polly.configure({ expiryStrategy: 'warn' });\n      expect(await testExpiration.call(this)).to.equal(false);\n    });\n\n    it('re-records on expired recording if expiryStrategy is \"record\"', async function () {\n      this.polly.configure({ expiryStrategy: 'record' });\n      expect(await testExpiration.call(this)).to.equal(true);\n    });\n\n    it('throws on expired recording if expiryStrategy is \"error\"', async function () {\n      const { server } = this.polly;\n      let error;\n\n      this.polly.configure({ expiryStrategy: 'error' });\n      server.any().on('error', (req, e) => (error = e));\n\n      try {\n        await testExpiration.call(this);\n      } catch (e) {\n        // noop\n      }\n\n      expect(error).to.exist;\n      expect(error.message).to.match(\n        /Recording for the following request has expired/\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "tests/integration/persister-tests.js",
    "content": "import { Polly } from '@pollyjs/core';\nimport * as validate from 'har-validator/lib/async';\n\nexport default function persisterTests() {\n  it('should persist valid HAR', async function () {\n    const { recordingId, persister } = this.polly;\n\n    this.polly.record();\n    await this.fetchRecord();\n    await persister.persist();\n\n    expect(await validate.har(await persister.findRecording(recordingId))).to.be\n      .true;\n\n    await this.fetchRecord({\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({ foo: 'bar', bar: 'baz' })\n    });\n\n    await persister.persist();\n\n    expect(await validate.har(await persister.findRecording(recordingId))).to.be\n      .true;\n  });\n\n  it('should have the correct metadata', async function () {\n    const { recordingId, recordingName, persister } = this.polly;\n\n    this.polly.record();\n    await this.fetchRecord();\n    await persister.persist();\n\n    const har = await persister.findRecording(recordingId);\n    const { _recordingName, creator, entries } = har.log;\n    const entry = entries[0];\n\n    expect(_recordingName).to.equal(recordingName);\n\n    expect(creator.name).to.equal('Polly.JS');\n    expect(creator.version).to.equal(Polly.VERSION);\n    expect(creator.comment).to.equal(\n      `${persister.constructor.type}:${persister.constructor.id}`\n    );\n\n    expect(entry).to.be.an('object');\n    expect(entry._id).to.a('string');\n    expect(entry._order).to.equal(0);\n  });\n\n  it('should add new entries to an existing recording', async function () {\n    const { recordingId, recordingName, config } = this.polly;\n    let { persister } = this.polly;\n\n    const orderedRecordUrl = (order) => `${this.recordUrl()}?order=${order}`;\n\n    this.polly.record();\n    await this.fetch(orderedRecordUrl(1));\n    await persister.persist();\n\n    let har = await persister.findRecording(recordingId);\n\n    expect(har.log.entries).to.have.lengthOf(1);\n\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    persister = this.polly.persister;\n\n    this.polly.record();\n    await this.fetch(orderedRecordUrl(1));\n    await this.fetch(orderedRecordUrl(1));\n    await this.fetch(orderedRecordUrl(2));\n    await persister.persist();\n\n    har = await persister.findRecording(recordingId);\n\n    expect(har.log.entries).to.have.lengthOf(3);\n    expect(\n      har.log.entries.filter((e) => e.request.url.includes(orderedRecordUrl(1)))\n    ).to.have.lengthOf(2);\n    expect(\n      har.log.entries.filter((e) => e.request.url.includes(orderedRecordUrl(2)))\n    ).to.have.lengthOf(1);\n  });\n\n  it('should emit beforePersist', async function () {\n    const { persister, server } = this.polly;\n    let beforePersistCalled = false;\n\n    server.get(this.recordUrl()).on('beforePersist', (req /*, res*/) => {\n      expect(beforePersistCalled).to.be.false;\n      expect(() => (req.body = 'test')).to.throw(Error);\n      beforePersistCalled = true;\n    });\n\n    this.polly.record();\n\n    await this.fetchRecord();\n    expect(beforePersistCalled).to.be.false;\n\n    await persister.persist();\n    expect(beforePersistCalled).to.be.true;\n  });\n\n  it('should respect recording name overrides', async function () {\n    const { server, persister } = this.polly;\n    const recordingName = 'Default Override';\n    let recordingId;\n\n    server\n      .get(this.recordUrl())\n      .recordingName(recordingName)\n      .on('request', (req) => {\n        expect(req.recordingName).to.equal(recordingName);\n        recordingId = req.recordingId;\n      });\n\n    this.polly.record();\n    await this.fetchRecord();\n    await persister.persist();\n\n    expect(recordingId).to.include('Override');\n\n    const har = await persister.findRecording(recordingId);\n\n    expect(await validate.har(har)).to.be.true;\n    expect(har.log.entries).to.have.lengthOf(1);\n\n    // Set the new recording name so the afterEach hook deletes the recording\n    this.polly.recordingName = recordingName;\n  });\n\n  it('should correctly handle array header values', async function () {\n    const { recordingId, server, persister } = this.polly;\n    let responseCalled = false;\n\n    this.polly.record();\n\n    server\n      .get(this.recordUrl())\n      .configure({ matchRequestsBy: { order: false } })\n      .once('beforeResponse', (req, res) => {\n        res.setHeaders({\n          string: 'foo',\n          one: ['foo'],\n          two: ['foo', 'bar']\n        });\n      });\n\n    await this.fetchRecord();\n    await persister.persist();\n\n    const har = await persister.findRecording(recordingId);\n    const { headers } = har.log.entries[0].response;\n\n    expect(await validate.har(har)).to.be.true;\n    expect(\n      headers.filter(({ _fromType }) => _fromType === 'array')\n    ).to.have.lengthOf(3);\n\n    this.polly.replay();\n\n    server.get(this.recordUrl()).once('response', (req, res) => {\n      expect(res.getHeader('string')).to.equal('foo');\n      expect(res.getHeader('one')).to.deep.equal(['foo']);\n      expect(res.getHeader('two')).to.deep.equal(['foo', 'bar']);\n      responseCalled = true;\n    });\n\n    await this.fetchRecord();\n    expect(responseCalled).to.be.true;\n  });\n\n  it('should correctly handle array header values where a single header is expected', async function () {\n    const { recordingId, server, persister } = this.polly;\n\n    this.polly.record();\n\n    server.get(this.recordUrl()).once('beforeResponse', (req, res) => {\n      res.setHeaders({\n        Location: ['./index.html'],\n        'Content-Type': ['application/json']\n      });\n    });\n\n    await this.fetchRecord();\n    await persister.persist();\n\n    const har = await persister.findRecording(recordingId);\n    const { content, redirectURL } = har.log.entries[0].response;\n\n    expect(await validate.har(har)).to.be.true;\n    expect(content.mimeType).to.equal('application/json');\n    expect(redirectURL).to.equal('./index.html');\n  });\n\n  it('should error when persisting a failed request', async function () {\n    let error;\n\n    this.polly.configure({ recordFailedRequests: false });\n\n    try {\n      await this.relativeFetch('/echo?status=400');\n      await this.polly.stop();\n    } catch (e) {\n      error = e;\n    } finally {\n      const savedRecording = await this.polly.persister.findRecording(\n        this.polly.recordingId\n      );\n\n      expect(savedRecording).to.be.null;\n      expect(error.message).to.contain('Cannot persist response for');\n\n      // Clear the pending requests so `this.polly.stop()` in the\n      // afterEach hook won't bomb.\n      this.polly.persister.pending.clear();\n    }\n  });\n\n  it('should not error when persisting a failed request and `recordFailedRequests` is true', async function () {\n    this.polly.configure({ recordFailedRequests: true });\n\n    await this.relativeFetch('/echo?status=400');\n    await this.polly.stop();\n\n    const har = await this.polly.persister.findRecording(\n      this.polly.recordingId\n    );\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(1);\n  });\n\n  it('should not error when persisting a 302 request and `recordFailedRequests` is false', async function () {\n    this.polly.configure({ recordFailedRequests: false });\n\n    await this.relativeFetch('/echo?status=302');\n    await this.polly.stop();\n\n    const har = await this.polly.persister.findRecording(\n      this.polly.recordingId\n    );\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(1);\n  });\n\n  it('should remove unused entries when `keepUnusedRequests` is false', async function () {\n    const { recordingName, recordingId, config } = this.polly;\n\n    const orderedRecordUrl = (order) => `${this.recordUrl()}?order=${order}`;\n\n    await this.fetch(orderedRecordUrl(1));\n    await this.fetch(orderedRecordUrl(2));\n    await this.polly.persister.persist();\n\n    let har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(2);\n\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    this.polly.replay();\n    this.polly.configure({\n      persisterOptions: {\n        keepUnusedRequests: false\n      }\n    });\n\n    await this.fetch(orderedRecordUrl(1)); // -> Replay\n    await this.fetch(orderedRecordUrl(3)); // -> New recording\n    await this.polly.persister.persist();\n\n    har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(2);\n    expect(har.log.entries[0].request.url).to.include(orderedRecordUrl(1));\n    expect(har.log.entries[1].request.url).to.include(orderedRecordUrl(3));\n  });\n\n  it('should sort the entries by date', async function () {\n    this.polly.configure({\n      persisterOptions: {\n        keepUnusedRequests: true\n      }\n    });\n    const { recordingName, recordingId, config } = this.polly;\n\n    const orderedRecordUrl = (order) => `${this.recordUrl()}?order=${order}`;\n\n    await this.fetch(orderedRecordUrl(1));\n    await this.fetch(orderedRecordUrl(2));\n    await this.polly.persister.persist();\n\n    let har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(2);\n    expect(har.log.entries[0].request.url).to.include(orderedRecordUrl(1));\n    expect(har.log.entries[1].request.url).to.include(orderedRecordUrl(2));\n\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    this.polly.record();\n\n    await this.fetch(orderedRecordUrl(3));\n    await this.fetch(orderedRecordUrl(4));\n    await this.fetch(orderedRecordUrl(2));\n    await this.polly.persister.persist();\n\n    har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(4);\n    expect(har.log.entries[0].request.url).to.include(orderedRecordUrl(1));\n    expect(har.log.entries[1].request.url).to.include(orderedRecordUrl(3));\n    expect(har.log.entries[2].request.url).to.include(orderedRecordUrl(4));\n    expect(har.log.entries[3].request.url).to.include(orderedRecordUrl(2));\n  });\n\n  it('should not sort the entries by date if `disableSortingHarEntries` is true', async function () {\n    this.polly.configure({\n      persisterOptions: {\n        keepUnusedRequests: true,\n        disableSortingHarEntries: true\n      }\n    });\n    const { recordingName, recordingId, config } = this.polly;\n\n    const orderedRecordUrl = (order) => `${this.recordUrl()}?order=${order}`;\n\n    await this.fetch(orderedRecordUrl(1));\n    await this.fetch(orderedRecordUrl(2));\n    await this.polly.persister.persist();\n\n    let har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(2);\n    expect(har.log.entries[0].request.url).to.include(orderedRecordUrl(1));\n    expect(har.log.entries[1].request.url).to.include(orderedRecordUrl(2));\n\n    await this.polly.stop();\n\n    this.polly = new Polly(recordingName, config);\n    this.polly.replay();\n\n    await this.fetch(orderedRecordUrl(3));\n    await this.fetch(orderedRecordUrl(4));\n    await this.polly.persister.persist();\n\n    har = await this.polly.persister.findRecording(recordingId);\n\n    expect(har).to.be.an('object');\n    expect(har.log.entries).to.have.lengthOf(4);\n    expect(har.log.entries[0].request.url).to.include(orderedRecordUrl(3));\n    expect(har.log.entries[1].request.url).to.include(orderedRecordUrl(4));\n    expect(har.log.entries[2].request.url).to.include(orderedRecordUrl(1));\n    expect(har.log.entries[3].request.url).to.include(orderedRecordUrl(2));\n  });\n\n  it('should correctly handle binary responses', async function () {\n    const { recordingId, server, persister } = this.polly;\n    let har, content;\n\n    this.polly.record();\n\n    // Non binary content\n    server.get(this.recordUrl()).once('beforeResponse', (req, res) => {\n      res.body = 'Some content';\n    });\n\n    await this.fetchRecord();\n    await persister.persist();\n\n    har = await persister.findRecording(recordingId);\n    content = har.log.entries[0].response.content;\n\n    expect(await validate.har(har)).to.be.true;\n    expect(content.encoding).to.be.undefined;\n\n    // Binary content\n    server.get(this.recordUrl()).once('beforeResponse', (req, res) => {\n      res.encoding = 'base64';\n      res.body = 'U29tZSBjb250ZW50';\n    });\n\n    await this.fetchRecord();\n    await persister.persist();\n\n    har = await persister.findRecording(recordingId);\n    content = har.log.entries[1].response.content;\n\n    expect(await validate.har(har)).to.be.true;\n    expect(content.encoding).to.equal('base64');\n\n    // Binary content with no body\n    server.get(this.recordUrl()).once('beforeResponse', (req, res) => {\n      res.encoding = 'base64';\n      res.body = '';\n    });\n\n    await this.fetchRecord();\n    await persister.persist();\n\n    har = await persister.findRecording(recordingId);\n    content = har.log.entries[2].response.content;\n\n    expect(await validate.har(har)).to.be.true;\n    expect(content.encoding).to.be.undefined;\n  });\n}\n"
  },
  {
    "path": "tests/middleware.js",
    "content": "/* eslint-env node */\nconst path = require('path');\n\nconst bodyParser = require('body-parser');\nconst compression = require('compression');\n\nconst { registerExpressAPI } = require('../packages/@pollyjs/node-server');\n\nconst DB = {};\n\nmodule.exports = function attachMiddleware(app) {\n  registerExpressAPI(app, {\n    recordingsDir: path.join(__dirname, 'recordings')\n  });\n\n  app.get('/assets/:name', (req, res) => {\n    res.sendFile(path.join(__dirname, 'assets', req.params.name));\n  });\n\n  app.use(bodyParser.json());\n\n  app.get('/echo', (req, res) => {\n    const status = req.query.status;\n\n    if (status === '204') {\n      res.status(204).send();\n    } else {\n      res.sendStatus(req.query.status);\n    }\n  });\n\n  app.post('/compress', compression({ filter: () => true }), (req, res) => {\n    res.write(JSON.stringify(req.body));\n    res.end();\n  });\n\n  app.get('/api', (req, res) => {\n    res.sendStatus(200);\n  });\n\n  app.get('/api/db/:id', (req, res) => {\n    const { id } = req.params;\n\n    if (DB[id]) {\n      res.status(200).json(DB[id]);\n    } else {\n      res.status(404).end();\n    }\n  });\n\n  app.post('/api/db/:id', (req, res) => {\n    const { id } = req.params;\n\n    DB[id] = req.body;\n    res.status(200).json(DB[id]);\n  });\n\n  app.delete('/api/db/:id', (req, res) => {\n    const { id } = req.params;\n\n    delete DB[id];\n    res.status(200).end();\n  });\n};\n"
  },
  {
    "path": "tests/node-setup.js",
    "content": "/* eslint-env node */\n\nglobal.expect = require('chai').expect;\n"
  }
]