mappersmith
Advanced tools
Comparing version 2.33.3 to 2.34.0
@@ -26,2 +26,3 @@ "use strict"; | ||
* @param {String} obj.host | ||
* @param {boolean} obj.allowResourceHostOverride - default: false | ||
* @param {Object} obj.gatewayConfigs - default: base values from mappersmith | ||
@@ -41,2 +42,3 @@ * @param {Object} obj.ignoreGlobalMiddleware - default: false | ||
this.host = obj.host; | ||
this.allowResourceHostOverride = obj.allowResourceHostOverride || false; | ||
this.bodyAttr = obj.bodyAttr; | ||
@@ -43,0 +45,0 @@ this.headersAttr = obj.headersAttr; |
@@ -16,3 +16,3 @@ "use strict"; | ||
/* global VERSION */ | ||
var version = "2.33.3"; | ||
var version = "2.34.0"; | ||
exports.version = version; | ||
@@ -19,0 +19,0 @@ var configs = { |
@@ -12,2 +12,3 @@ "use strict"; | ||
* @param {String} obj.host | ||
* @param {boolean} obj.allowResourceHostOverride | ||
* @param {String|Function} obj.path | ||
@@ -26,2 +27,3 @@ * @param {String} obj.method | ||
this.host = obj.host; | ||
this.allowResourceHostOverride = obj.allowResourceHostOverride || false; | ||
this.path = obj.path; | ||
@@ -28,0 +30,0 @@ this.method = obj.method || 'get'; |
{ | ||
"name": "mappersmith", | ||
"version": "2.33.3", | ||
"version": "2.34.0", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
@@ -344,2 +344,18 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith) | ||
*NOTE*: Since version `2.34.0` you need to also use `allowResourceHostOverride: true`, example: | ||
``` | ||
const client = forge({ | ||
host: 'https://new-host.com', | ||
allowResourceHostOverride: true, | ||
resources: { | ||
User: { | ||
all: { path: '/users', host: 'https://old-host.com } | ||
} | ||
} | ||
}) | ||
``` | ||
Whenever using host overrides, be diligent about how you pass parameters to your resource methods. If you spread unverified attributes, you might open your server to SSR attacks. | ||
### <a name="binary-data"></a> Binary data | ||
@@ -1225,3 +1241,3 @@ | ||
__Mappersmith__ does not apply any polyfills, it depends on a native `fetch` implementation to be supported. It is possible assign the fetch implementation used by Mappersmith: | ||
__Mappersmith__ does not apply any polyfills, it depends on a native `fetch` implementation to be supported. It is possible to assign the fetch implementation used by Mappersmith: | ||
@@ -1228,0 +1244,0 @@ ```javascript |
@@ -62,3 +62,7 @@ "use strict"; | ||
host: function host() { | ||
var originalHost = this.requestParams[this.methodDescriptor.hostAttr] || this.methodDescriptor.host || ''; | ||
var _this$methodDescripto = this.methodDescriptor, | ||
allowResourceHostOverride = _this$methodDescripto.allowResourceHostOverride, | ||
hostAttr = _this$methodDescripto.hostAttr, | ||
host = _this$methodDescripto.host; | ||
var originalHost = allowResourceHostOverride ? this.requestParams[hostAttr] || host || '' : host || ''; | ||
return originalHost.replace(REGEXP_TRAILING_SLASH, ''); | ||
@@ -65,0 +69,0 @@ }, |
@@ -5,3 +5,5 @@ declare module 'mappersmith/middleware/encode-json' { | ||
const EncodeJson: Middleware | ||
export var CONTENT_TYPE_JSON: string | ||
export default EncodeJson | ||
} |
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
152309
2873
1376