Comparing version 2.0.0 to 2.1.0
@@ -7,2 +7,3 @@ export interface Request { | ||
cors?: boolean; | ||
withCredentials?: boolean; | ||
} | ||
@@ -9,0 +10,0 @@ export interface Response { |
@@ -57,3 +57,3 @@ /*! ***************************************************************************** | ||
xhr.open(request.method, request.url, true); | ||
xhr.withCredentials = request.cors; | ||
xhr.withCredentials = request.withCredentials; | ||
// Add each header to the XHR request | ||
@@ -97,5 +97,10 @@ for (var k in request.headers) { | ||
var contentType = (request.body instanceof FormData ? "multipart/form-data" : "text/plain"); | ||
// The "cors" option is being deprecated in favor of the more properly | ||
// named "withCredentials" | ||
if (request.cors) { | ||
console.warn("DEPRECATION WARNING: Use `withCredentials` instead of `cors`."); | ||
} | ||
// Create a new copy of our request object so middleware doesn't mutate | ||
// a given object | ||
request = __assign({ method: "GET", cors: true, headers: { | ||
request = __assign({ method: "GET", withCredentials: (request.cors || false), headers: { | ||
"Content-Type": contentType | ||
@@ -102,0 +107,0 @@ } }, request); |
@@ -61,3 +61,3 @@ 'use strict'; | ||
xhr.open(request.method, request.url, true); | ||
xhr.withCredentials = request.cors; | ||
xhr.withCredentials = request.withCredentials; | ||
// Add each header to the XHR request | ||
@@ -101,5 +101,10 @@ for (var k in request.headers) { | ||
var contentType = (request.body instanceof FormData ? "multipart/form-data" : "text/plain"); | ||
// The "cors" option is being deprecated in favor of the more properly | ||
// named "withCredentials" | ||
if (request.cors) { | ||
console.warn("DEPRECATION WARNING: Use `withCredentials` instead of `cors`."); | ||
} | ||
// Create a new copy of our request object so middleware doesn't mutate | ||
// a given object | ||
request = __assign({ method: "GET", cors: true, headers: { | ||
request = __assign({ method: "GET", withCredentials: (request.cors || false), headers: { | ||
"Content-Type": contentType | ||
@@ -106,0 +111,0 @@ } }, request); |
{ | ||
"name": "portals", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Client-side HTTP requests with middleware support.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -49,3 +49,3 @@ ![Portals](logo.png) | ||
**body** | `any` | The request body used by `POST`, `PUT` and `PATCH` requests. By default, you should use `string` or `FormData` formats unless you have middleware in place to handle type conversions. | ||
**cors** | `boolean` | Sets the value of the `.withCredentials` property of the XHR instance for the request in order to allow Cross-Domain calls. _Defaults to `true`._ | ||
**withCredentials** | `boolean` | Sets the value of the `.withCredentials` property of the XHR instance for the request in order to allow secured cross-domain calls. _Defaults to `true`._ | ||
@@ -52,0 +52,0 @@ ### The Response Object |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29651
530
0
12