Comparing version 1.2.0 to 1.3.0
15
index.js
@@ -81,5 +81,14 @@ var asArray = require('as-array'); | ||
var mock = self.mock(method, uri); | ||
return mock | ||
? mock.fn()() | ||
: rawHttp(extend(resourceObject, resource.xhrOptions || {})); | ||
if (mock) { | ||
mock.request = { | ||
body: params, | ||
method: method, | ||
pathname: slash(uri), | ||
headers: resource.headers | ||
}; | ||
return mock.fn()(); | ||
} | ||
else { | ||
return rawHttp(extend(resourceObject, resource.xhrOptions || {})); | ||
} | ||
}; | ||
@@ -86,0 +95,0 @@ |
{ | ||
"name": "ask", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A simple, chainable way to construct HTTP requests in Node or the browser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,15 @@ var expect = require('chai').expect; | ||
it('provides the request body in the response', function () { | ||
var tester = request.post('test'); | ||
request.when('POST', '/test') | ||
.respond('testing'); | ||
return tester({body: 'body'}).then(function (res) { | ||
expect(res.request.body).to.eql({body: 'body'}); | ||
}); | ||
}); | ||
it('sets a custom status code', function () { | ||
@@ -45,0 +58,0 @@ request |
Sorry, the diff of this file is too big to display
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
308948
8714
3