mappersmith
Advanced tools
Comparing version 2.24.0 to 2.24.1
@@ -18,3 +18,3 @@ 'use strict'; | ||
/* global VERSION */ | ||
var version = exports.version = '2.24.0'; | ||
var version = exports.version = '2.24.1'; | ||
@@ -21,0 +21,0 @@ var configs = exports.configs = { |
@@ -38,14 +38,7 @@ 'use strict'; | ||
this.body = this.bodyFunction ? props.body : (0, _utils.toQueryString)(props.body); | ||
this.responseData = props.response.body; | ||
this.responseHeaders = props.response.headers || {}; | ||
this.setResponseData(props.response.body); | ||
this.responseStatus = props.response.status || 200; | ||
this.calls = []; | ||
if ((0, _utils.isPlainObject)(this.responseData)) { | ||
this.responseData = JSON.stringify(this.responseData); | ||
if (!this.responseHeaders['content-type']) { | ||
this.responseHeaders['content-type'] = 'application/json'; | ||
} | ||
} | ||
} | ||
@@ -55,2 +48,19 @@ | ||
/** | ||
* If passed a plain object, the data is stringified and the content-type header is set to JSON | ||
* | ||
* @public | ||
*/ | ||
setResponseData: function setResponseData(responseData) { | ||
if ((0, _utils.isPlainObject)(responseData)) { | ||
this.responseData = JSON.stringify(responseData); | ||
if (!this.responseHeaders['content-type']) { | ||
this.responseHeaders['content-type'] = 'application/json'; | ||
} | ||
} else { | ||
this.responseData = responseData; | ||
} | ||
}, | ||
/** | ||
* @return {Response} | ||
@@ -57,0 +67,0 @@ */ |
@@ -155,3 +155,3 @@ 'use strict'; | ||
this.mockRequest.responseStatus = responseStatus; | ||
this.mockRequest.responseData = responseData; | ||
this.mockRequest.setResponseData(responseData); | ||
@@ -158,0 +158,0 @@ return this.mockRequest; |
{ | ||
"name": "mappersmith", | ||
"version": "2.24.0", | ||
"version": "2.24.1", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
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
113473
2184