@pollyjs/core
Advanced tools
Comparing version 1.4.2 to 2.0.0
@@ -6,2 +6,22 @@ # Change Log | ||
# [2.0.0](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.4.2...v2.0.0) (2019-01-29) | ||
### Features | ||
* 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)) | ||
* 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) | ||
### BREAKING CHANGES | ||
* The node-http adapter no longer accepts the `transports` option | ||
* Any adapters calling `pollyRequest.respond` should pass it a response object instead of the previous 3 arguments (statusCode, headers, body). | ||
## [1.4.2](https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core/compare/v1.4.1...v1.4.2) (2019-01-16) | ||
@@ -8,0 +28,0 @@ |
{ | ||
"name": "@pollyjs/core", | ||
"version": "1.4.2", | ||
"version": "2.0.0", | ||
"description": "Record, replay, and stub HTTP Interactions", | ||
@@ -47,3 +47,3 @@ "main": "dist/cjs/pollyjs-core.js", | ||
"dependencies": { | ||
"@pollyjs/utils": "^1.4.1", | ||
"@pollyjs/utils": "^2.0.0", | ||
"@sindresorhus/fnv1a": "^1.0.0", | ||
@@ -58,5 +58,5 @@ "blueimp-md5": "^2.10.0", | ||
"devDependencies": { | ||
"@pollyjs/adapter": "^1.4.1", | ||
"@pollyjs/adapter-fetch": "^1.4.2", | ||
"@pollyjs/persister": "^1.4.1", | ||
"@pollyjs/adapter": "^2.0.0", | ||
"@pollyjs/adapter-fetch": "^2.0.0", | ||
"@pollyjs/persister": "^2.0.0", | ||
"npm-run-all": "^4.1.3", | ||
@@ -66,3 +66,3 @@ "rimraf": "^2.6.2", | ||
}, | ||
"gitHead": "0587aa80c63b9cd3ca202cf8c5732a996ced6184" | ||
"gitHead": "9db417a2e41fd4a1bcb3dbe0ba183d93137f4847" | ||
} |
@@ -46,3 +46,3 @@ import md5 from 'blueimp-md5'; | ||
this.recordingId = polly.recordingId; | ||
this.requestArguments = freeze(request.requestArguments || []); | ||
this.requestArguments = freeze(request.requestArguments); | ||
this.promise = defer(); | ||
@@ -167,3 +167,5 @@ this[POLLY] = polly; | ||
async respond(status, headers, body) { | ||
async respond(response) { | ||
const { statusCode, headers, body } = response || {}; | ||
assert( | ||
@@ -177,5 +179,8 @@ 'Cannot respond to a request that already has a response.', | ||
// Set the status code and headers | ||
this.response.status(status).setHeaders(headers); | ||
// Set the status code | ||
this.response.status(statusCode); | ||
// Se the headers | ||
this.response.setHeaders(headers); | ||
// Set the body without modifying any headers (instead of using .send()) | ||
@@ -182,0 +187,0 @@ this.response.body = body; |
import RouteRecognizer from 'route-recognizer'; | ||
import castArray from 'lodash-es/castArray'; | ||
import { URL, assert, timeout, buildUrl } from '@pollyjs/utils'; | ||
import { HTTP_METHODS, URL, assert, timeout, buildUrl } from '@pollyjs/utils'; | ||
@@ -21,4 +21,2 @@ import Route from './route'; | ||
const METHODS = ['GET', 'PUT', 'POST', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']; | ||
const { keys } = Object; | ||
@@ -88,2 +86,6 @@ | ||
merge() { | ||
return this._register('MERGE', ...arguments); | ||
} | ||
head() { | ||
@@ -205,3 +207,3 @@ return this._register('HEAD', ...arguments); | ||
if (!this[REGISTRY][host]) { | ||
this[REGISTRY][host] = METHODS.reduce((acc, method) => { | ||
this[REGISTRY][host] = HTTP_METHODS.reduce((acc, method) => { | ||
acc[method] = new RouteRecognizer(); | ||
@@ -208,0 +210,0 @@ acc[method][HANDLERS] = new Map(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2292426
24582
+ Added@pollyjs/utils@2.6.3(transitive)
- Removed@pollyjs/utils@1.4.1(transitive)
Updated@pollyjs/utils@^2.0.0