Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "rest", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "./rest.js", | ||
@@ -5,0 +5,0 @@ "moduleType": ["amd", "node"], |
@@ -142,5 +142,5 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
this, | ||
this.document | ||
typeof window !== 'undefined' ? window : void 0, | ||
typeof document !== 'undefined' ? document : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
@@ -14,3 +14,3 @@ /* | ||
var parser, http, https, when, UrlBuilder, normalizeHeaderName, responsePromise, client, httpsExp; | ||
var parser, http, https, when, UrlBuilder, mixin, normalizeHeaderName, responsePromise, client, httpsExp; | ||
@@ -22,2 +22,3 @@ parser = envRequire('url'); | ||
UrlBuilder = require('../UrlBuilder'); | ||
mixin = require('../util/mixin'); | ||
normalizeHeaderName = require('../util/normalizeHeaderName'); | ||
@@ -78,3 +79,4 @@ responsePromise = require('../util/responsePromise'); | ||
options = parser.parse(url); | ||
options = mixin({}, request.mixin, parser.parse(url)); | ||
entity = request.entity; | ||
@@ -81,0 +83,0 @@ request.method = request.method || (entity ? 'POST' : 'GET'); |
@@ -81,4 +81,4 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
this.XDomainRequest | ||
typeof window !== 'undefined' ? window.XDomainRequest : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
@@ -147,4 +147,4 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
this | ||
typeof window !== 'undefined' ? window : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
@@ -84,3 +84,22 @@ # Clients | ||
Node specific settings may be modified via the `mixin` request property. Adding new certificate authorities to trust or changing the agent pool are rare, but sometimes necessary. See the [Node docs](http://nodejs.org/api/https.html#https_https_request_options_callback) for details about supported properties. | ||
**Special Properties** | ||
<table> | ||
<tr> | ||
<th>Property</th> | ||
<th>Required?</th> | ||
<th>Default</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr> | ||
<td>request.mixin</td> | ||
<td>optional</td> | ||
<td><em>empty</em></td> | ||
<td>Additional Node.js only parameters</td> | ||
</tr> | ||
</table> | ||
<a name="module-rest/client/jsonp"></a> | ||
@@ -87,0 +106,0 @@ ### JSONP Client |
@@ -8,3 +8,3 @@ /* | ||
(function (define) { | ||
(function (define, global) { | ||
'use strict'; | ||
@@ -20,4 +20,4 @@ | ||
hasXdr = 'XDomainRequest' in window; | ||
hasXhrCors = window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest(); | ||
hasXdr = 'XDomainRequest' in global; | ||
hasXhrCors = global.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest(); | ||
@@ -60,4 +60,5 @@ /** | ||
}( | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); } | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
typeof window !== 'undefined' ? window : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
@@ -66,4 +66,4 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
this | ||
typeof window !== 'undefined' ? window : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
@@ -145,4 +145,4 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
typeof global === 'undefined' ? this : global | ||
typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
{ | ||
"name": "rest", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "RESTful HTTP client library", | ||
@@ -47,3 +47,3 @@ "keywords": ["rest", "http", "client", "rest-template", "spring", "cujojs"], | ||
"test": "jshint . && buster test --node", | ||
"ci": "npm test && sauceme", | ||
"ci": "npm test && sauceme -b test/browsers.json", | ||
"start": "buster static -e browser", | ||
@@ -50,0 +50,0 @@ "tunnel": "sauceme -m" |
@@ -147,4 +147,4 @@ rest.js | ||
- Firefox (stable, ESR, should work in earlier versions) | ||
- IE (6-10) | ||
- Safari (5, 6, iOS 4-6, should work in earlier versions) | ||
- IE (6-11) | ||
- Safari (5-7, iOS 4-7.1, should work in earlier versions) | ||
- Opera (11, 12, should work in earlier versions) | ||
@@ -233,2 +233,7 @@ | ||
1.1.1 | ||
- support for IE 11, Safari 7 and iOS 7 (no code changes required, now actively testing) | ||
- Node specific configuration options via request.mixin. Particularly useful for https clients. Thanks @wwwdata | ||
- basic support for Browserify. Note: Browserify is not yet a tested environment | ||
1.1.0 | ||
@@ -235,0 +240,0 @@ - bump when.js version to ~3, 2.x is no longer supported |
@@ -21,3 +21,3 @@ /* | ||
var rest, client, responsePromise, http, server; | ||
var rest, client, responsePromise, http, https, fs, serverHttp, serverHttps; | ||
@@ -28,7 +28,14 @@ rest = require('rest'); | ||
http = require('http'); | ||
https = require('https'); | ||
fs = require('fs'); | ||
buster.testCase('rest/client/node', { | ||
setUp: function () { | ||
server = http.createServer(); | ||
server.on('request', function (request, response) { | ||
serverHttp = http.createServer(); | ||
serverHttps = https.createServer({ | ||
key: fs.readFileSync(__dirname + '/node-ssl.key'), | ||
cert: fs.readFileSync(__dirname + '/node-ssl.crt') | ||
}); | ||
function handle(request, response) { | ||
var requestBody = ''; | ||
@@ -48,9 +55,14 @@ request.on('data', function (chunk) { | ||
request.on('error', function () { console.log('server error'); }); | ||
}); | ||
} | ||
serverHttp.on('request', handle); | ||
serverHttps.on('request', handle); | ||
// TODO handle port conflicts | ||
server.listen(8080); | ||
serverHttp.listen(8080); | ||
serverHttps.listen(8443); | ||
}, | ||
tearDown: function () { | ||
server.close(); | ||
serverHttp.close(); | ||
serverHttps.close(); | ||
}, | ||
@@ -104,2 +116,20 @@ | ||
}, | ||
'should make an https request': function () { | ||
var request = { | ||
path: 'https://localhost:8443/', | ||
mixin: { rejectUnauthorized: false } | ||
}; | ||
return client(request).then(function (response) { | ||
assert(response.raw.request instanceof http.ClientRequest); | ||
// assert(response.raw.response instanceof http.ClientResponse); | ||
assert(response.raw.response); | ||
assert.same(request, response.request); | ||
assert.equals(response.request.method, 'GET'); | ||
assert.equals(response.entity, 'hello world'); | ||
assert.equals(response.status.code, 200); | ||
assert.equals('text/plain', response.headers['Content-Type']); | ||
assert.equals(response.entity.length, parseInt(response.headers['Content-Length'], 10)); | ||
refute(request.canceled); | ||
}).otherwise(fail); | ||
}, | ||
'should abort the request if canceled': function () { | ||
@@ -106,0 +136,0 @@ var request, response; |
@@ -226,4 +226,4 @@ /* | ||
typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }, | ||
this.location | ||
typeof window !== 'undefined' ? window.location : void 0 | ||
// Boilerplate for AMD and Node | ||
)); |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
394699
107
8398
333
57
2