@shopify/jest-koa-mocks
Advanced tools
Comparing version 5.0.2 to 5.1.0
@@ -5,3 +5,2 @@ 'use strict'; | ||
var url = require('url'); | ||
var stream = require('stream'); | ||
@@ -27,3 +26,3 @@ var httpMocks = require('node-mocks-http'); | ||
rawBody = '', | ||
url: url$1 = '', | ||
url = '/', | ||
host = 'test.com', | ||
@@ -43,6 +42,4 @@ encrypted = false, | ||
}; | ||
const protocolFallback = encrypted ? 'https' : 'http'; | ||
const urlObject = new url.URL(url$1, `${protocolFallback}://${host}`); | ||
const req = httpMocks__default["default"].createRequest({ | ||
url: urlObject.toString(), | ||
url, | ||
method, | ||
@@ -53,3 +50,3 @@ statusCode, | ||
// Koa determines protocol based on the `Host` header. | ||
Host: urlObject.host, | ||
Host: host, | ||
...headers | ||
@@ -63,3 +60,3 @@ } | ||
writable: false, | ||
value: urlObject.protocol === 'https:' | ||
value: encrypted | ||
}); | ||
@@ -66,0 +63,0 @@ const res = httpMocks__default["default"].createResponse(); // Koa sets a default status code of 404, not the node default of 200 |
{ | ||
"name": "@shopify/jest-koa-mocks", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Utilities to easily stub Koa context and cookies", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
21354
230