Comparing version 0.9.0 to 0.9.1
{ | ||
"name": "rest", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"main": "./rest.js", | ||
"dependencies": { | ||
"when": "~2" | ||
"when": ">1.8.0 <=3.0.0" | ||
} | ||
} |
@@ -96,3 +96,3 @@ /* | ||
successResponseHandler = handlers.success || handlers.response || defaultResponseHandler; | ||
errorResponseHandler = handlers.error || function () { | ||
errorResponseHandler = handlers.error || function () { | ||
// Propagate the rejection, with the result of the handler | ||
@@ -99,0 +99,0 @@ return when.reject((handlers.response || defaultResponseHandler).apply(this, arguments)); |
{ | ||
"name": "rest", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "RESTful HTTP client library", | ||
@@ -33,3 +33,3 @@ "keywords": ["rest", "http", "client", "rest-template", "spring", "cujojs"], | ||
"dependencies": { | ||
"when": "~2" | ||
"when": ">1.8.0 <=3.0.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
@@ -107,3 +107,2 @@ rest.js | ||
} | ||
``` | ||
@@ -146,3 +145,3 @@ | ||
Tested environments: | ||
- Node.js (0.8, 0.6, should work in 0.10) | ||
- Node.js (0.6, 0.8. 0.10) | ||
- Chrome (stable) | ||
@@ -234,2 +233,6 @@ - Firefox (stable, ESR, should work in earlier versions) | ||
0.9.1 | ||
- add Node 0.10 as a tested environment | ||
- restore when 1.8 compat, when 2.0 is still preferred | ||
0.9.0 | ||
@@ -236,0 +239,0 @@ - moving from the 's2js' to the 'cujojs' organization |
@@ -27,5 +27,5 @@ /* | ||
buster.testCase('rest/client/jsonp', { | ||
'should make a GET by default': function (done) { | ||
'should make a GET by default': function () { | ||
var request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'javascript' } }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert(response.entity.responseData); | ||
@@ -35,7 +35,7 @@ assert.same(request, response.request); | ||
refute(response.raw.parentNode); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the jsonp client from the jsonp interceptor by default': function (done) { | ||
'should use the jsonp client from the jsonp interceptor by default': function () { | ||
var request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'html5' } }; | ||
jsonpInterceptor()(request).then(function (response) { | ||
return jsonpInterceptor()(request).then(function (response) { | ||
assert(response.entity.responseData); | ||
@@ -45,7 +45,8 @@ assert.same(request, response.request); | ||
refute(response.raw.parentNode); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should abort the request if canceled': function (done) { | ||
var request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'html5' } }; | ||
client(request).then( | ||
'should abort the request if canceled': function () { | ||
var request, response; | ||
request = { path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'html5' } }; | ||
response = client(request).then( | ||
fail, | ||
@@ -57,9 +58,10 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
refute(request.canceled); | ||
request.cancel(); | ||
return response; | ||
}, | ||
'should propogate request errors': function (done) { | ||
'should propogate request errors': function () { | ||
var request = { path: 'http://localhost:1234' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -69,7 +71,7 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should not make a request that has already been canceled': function (done) { | ||
'should not make a request that has already been canceled': function () { | ||
var request = { canceled: true, path: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0', params: { q: 'javascript' } }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -81,3 +83,3 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
@@ -84,0 +86,0 @@ 'should not be the default client': function () { |
@@ -54,5 +54,5 @@ /* | ||
'should make a GET by default': function (done) { | ||
'should make a GET by default': function () { | ||
var request = { path: 'http://localhost:8080/' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert(response.raw.request instanceof http.ClientRequest); | ||
@@ -68,7 +68,7 @@ // assert(response.raw.response instanceof http.ClientResponse); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit GET': function (done) { | ||
'should make an explicit GET': function () { | ||
var request = { path: 'http://localhost:8080/', method: 'GET' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
@@ -79,7 +79,7 @@ assert.equals(response.request.method, 'GET'); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make a POST with an entity': function (done) { | ||
'should make a POST with an entity': function () { | ||
var request = { path: 'http://localhost:8080/', entity: 'echo' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
@@ -92,7 +92,7 @@ assert.equals(response.request.method, 'POST'); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit POST with an entity': function (done) { | ||
'should make an explicit POST with an entity': function () { | ||
var request = { path: 'http://localhost:8080/', entity: 'echo', method: 'POST' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
@@ -102,6 +102,7 @@ assert.equals(response.request.method, 'POST'); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should abort the request if canceled': function (done) { | ||
var request = { path: 'http://localhost:8080/' }; | ||
'should abort the request if canceled': function () { | ||
var request, response; | ||
request = { path: 'http://localhost:8080/' }; | ||
client(request).then( | ||
@@ -112,9 +113,10 @@ fail, | ||
}) | ||
).ensure(done); | ||
); | ||
refute(request.canceled); | ||
request.cancel(); | ||
return response; | ||
}, | ||
'should propogate request errors': function (done) { | ||
'should propogate request errors': function () { | ||
var request = { path: 'http://localhost:1234' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -124,7 +126,7 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should not make a request that has already been canceled': function (done) { | ||
'should not make a request that has already been canceled': function () { | ||
var request = { canceled: true, path: 'http://localhost:1234' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -136,3 +138,3 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
@@ -139,0 +141,0 @@ 'should be the default client': function () { |
@@ -30,5 +30,5 @@ /* | ||
requiresSupportFor: { xdr: 'XDomainRequest' in window }, | ||
'should make a GET by default': function (done) { | ||
'should make a GET by default': function () { | ||
var request = { path: flickrUrl }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xdr; | ||
@@ -39,7 +39,7 @@ xdr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit GET': function (done) { | ||
'should make an explicit GET': function () { | ||
var request = { path: flickrUrl, method: 'GET' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xdr; | ||
@@ -51,7 +51,7 @@ xdr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make a POST with an entity': function (done) { | ||
'should make a POST with an entity': function () { | ||
var request = { path: flickrUrl, entity: 'hello world' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xdr; | ||
@@ -63,7 +63,7 @@ xdr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit POST with an entity': function (done) { | ||
'should make an explicit POST with an entity': function () { | ||
var request = { path: flickrUrl, entity: 'hello world', method: 'POST' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xdr; | ||
@@ -75,8 +75,9 @@ xdr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should abort the request if canceled': function (done) { | ||
'should abort the request if canceled': function () { | ||
// TDOO find an endpoint that takes a bit to respond, cached files may return synchronously | ||
var request = { path: flickrUrl, params: { q: Date.now() } }; | ||
client(request).then( | ||
var request, response; | ||
request = { path: flickrUrl, params: { q: Date.now() } }; | ||
response = client(request).then( | ||
fail, | ||
@@ -86,9 +87,10 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
refute(request.canceled); | ||
request.cancel(); | ||
return response; | ||
}, | ||
'should propogate request errors': function (done) { | ||
'should propogate request errors': function () { | ||
var request = { path: 'http://localhost:1234' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -98,7 +100,7 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should not make a request that has already been canceled': function (done) { | ||
'should not make a request that has already been canceled': function () { | ||
var request = { canceled: true, path: '/' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -110,3 +112,3 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
} | ||
@@ -113,0 +115,0 @@ }, |
@@ -31,5 +31,5 @@ /* | ||
buster.testCase('rest/client/xhr', { | ||
'should make a GET by default': function (done) { | ||
'should make a GET by default': function () { | ||
var request = { path: '/' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xhr, name; | ||
@@ -47,7 +47,7 @@ xhr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit GET': function (done) { | ||
'should make an explicit GET': function () { | ||
var request = { path: '/', method: 'GET' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xhr, name; | ||
@@ -65,7 +65,7 @@ xhr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make a POST with an entity': function (done) { | ||
'should make a POST with an entity': function () { | ||
var request = { path: '/', entity: 'hello world' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xhr, name; | ||
@@ -83,7 +83,7 @@ xhr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should make an explicit POST with an entity': function (done) { | ||
'should make an explicit POST with an entity': function () { | ||
var request = { path: '/', entity: 'hello world', method: 'POST' }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
var xhr, name; | ||
@@ -101,3 +101,3 @@ xhr = response.raw; | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -130,9 +130,9 @@ 'should abort the request if canceled': function (done) { | ||
}) | ||
]).ensure(done); | ||
]).always(done); | ||
}, | ||
'//should propogate request errors': function (done) { | ||
'//should propogate request errors': function () { | ||
// TODO follow up with Sauce Labs | ||
// this test is valid, but fails with sauce as their proxy returns a 400 | ||
var request = { path: 'http://localhost:1234' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -142,7 +142,7 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should not make a request that has already been canceled': function (done) { | ||
'should not make a request that has already been canceled': function () { | ||
var request = { canceled: true, path: '/' }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -154,9 +154,9 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should reject if an XHR impl is not available': { | ||
requiresSupportFor: { 'no-xhr': !window.XMLHttpRequest }, | ||
'': function (done) { | ||
'': function () { | ||
var request = { path: '/' }; | ||
xhr(request).then( | ||
return xhr(request).then( | ||
fail, | ||
@@ -167,3 +167,3 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
} | ||
@@ -170,0 +170,0 @@ }, |
@@ -42,25 +42,25 @@ /* | ||
}, | ||
'should apply query params to the query string': function (done) { | ||
'should apply query params to the query string': function () { | ||
var store = new RestStore({ client: client }); | ||
store.query({ q: 'what is the meaning of life?' }).then(function (response) { | ||
return store.query({ q: 'what is the meaning of life?' }).then(function (response) { | ||
assert.equals('what is the meaning of life?', response.request.params.q); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should get based on the id': function (done) { | ||
'should get based on the id': function () { | ||
var store = new RestStore({ client: client }); | ||
store.get(42).then(function (response) { | ||
return store.get(42).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
refute(response.request.method); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should remove based on the id': function (done) { | ||
'should remove based on the id': function () { | ||
var store = new RestStore({ client: client }); | ||
store.remove(42).then(function (response) { | ||
return store.remove(42).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
assert.equals('delete', response.request.method); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should add a record without an ID': function (done) { | ||
'should add a record without an ID': function () { | ||
var store = new RestStore({ client: client }); | ||
store.add({ foo: 'bar' }).then(function (response) { | ||
return store.add({ foo: 'bar' }).then(function (response) { | ||
assert.equals('', response.request.path); | ||
@@ -70,7 +70,7 @@ assert.equals('post', response.request.method); | ||
assert.equals('bar', response.request.entity.foo); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should add a record with an explicit ID': function (done) { | ||
'should add a record with an explicit ID': function () { | ||
var store = new RestStore({ client: client }); | ||
store.add({ foo: 'bar' }, { id: 42 }).then(function (response) { | ||
return store.add({ foo: 'bar' }, { id: 42 }).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
@@ -81,7 +81,7 @@ assert.equals('put', response.request.method); | ||
refute.equals('42', response.request.entity.id); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should add a record with an implicit ID': function (done) { | ||
'should add a record with an implicit ID': function () { | ||
var store = new RestStore({ client: client }); | ||
store.add({ foo: 'bar', id: 42 }).then(function (response) { | ||
return store.add({ foo: 'bar', id: 42 }).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
@@ -92,7 +92,7 @@ assert.equals('put', response.request.method); | ||
assert.equals('42', response.request.entity.id); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should add a record ignoring the ID': function (done) { | ||
'should add a record ignoring the ID': function () { | ||
var store = new RestStore({ client: client, ignoreId: true }); | ||
store.add({ foo: 'bar', id: 42 }).then(function (response) { | ||
return store.add({ foo: 'bar', id: 42 }).then(function (response) { | ||
assert.equals('', response.request.path); | ||
@@ -103,23 +103,23 @@ assert.equals('post', response.request.method); | ||
assert.equals('42', response.request.entity.id); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should put overwriting target': function (done) { | ||
'should put overwriting target': function () { | ||
var store = new RestStore({ client: client }); | ||
store.put({ foo: 'bar', id: 42 }, { overwrite: true }).then(function (response) { | ||
return store.put({ foo: 'bar', id: 42 }, { overwrite: true }).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
assert.equals('put', response.request.method); | ||
assert.equals('*', response.request.headers['If-Match']); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should put without overwriting target': function (done) { | ||
'should put without overwriting target': function () { | ||
var store = new RestStore({ client: client }); | ||
store.put({ foo: 'bar', id: 42 }, { overwrite: false }).then(function (response) { | ||
return store.put({ foo: 'bar', id: 42 }, { overwrite: false }).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
assert.equals('put', response.request.method); | ||
assert.equals('*', response.request.headers['If-None-Match']); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should put with default config': function (done) { | ||
'should put with default config': function () { | ||
var store = new RestStore({ client: client }); | ||
store.put({ foo: 'bar', id: 42 }).then(function (response) { | ||
return store.put({ foo: 'bar', id: 42 }).then(function (response) { | ||
assert.equals('42', response.request.path); | ||
@@ -129,3 +129,3 @@ assert.equals('put', response.request.method); | ||
refute(response.request.headers['If-Match']); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -132,0 +132,0 @@ 'should have a proper prototype chain': function () { |
@@ -38,3 +38,3 @@ /* | ||
buster.testCase('rest/dojo/wire', { | ||
'should create a RestStore for resource!': function (done) { | ||
'should create a RestStore for resource!': function () { | ||
var spec; | ||
@@ -45,7 +45,7 @@ spec = { | ||
}; | ||
wire(spec).then(function (spec) { | ||
return wire(spec).then(function (spec) { | ||
assert(spec.store instanceof RestStore); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should get with resource! waiting for data': function (done) { | ||
'should get with resource! waiting for data': function () { | ||
var spec; | ||
@@ -56,8 +56,8 @@ spec = { | ||
}; | ||
wire(spec).then(function (spec) { | ||
return wire(spec).then(function (spec) { | ||
assert.equals('bar', spec.resource.entity.foo); | ||
assert.equals('test/dojo/hello.json', spec.resource.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should support client!': function (done) { | ||
'should support client!': function () { | ||
var spec; | ||
@@ -68,7 +68,7 @@ spec = { | ||
}; | ||
wire(spec).then(function (spec) { | ||
return wire(spec).then(function (spec) { | ||
return spec.client({}).then(function (response) { | ||
assert.equals('bar', response.foo); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -75,0 +75,0 @@ }); |
@@ -45,12 +45,12 @@ /* | ||
buster.testCase('rest/interceptor', { | ||
'should set the originator client on the request for the, but do not overwrite': function (done) { | ||
'should set the originator client on the request for the, but do not overwrite': function () { | ||
var theInterceptor, client; | ||
theInterceptor = interceptor(); | ||
client = theInterceptor(defaultClient).chain(theInterceptor); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('default', response.id); | ||
assert.same(client, response.request.originator); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the client configured into the interceptor by default': function (done) { | ||
'should use the client configured into the interceptor by default': function () { | ||
var theInterceptor, client; | ||
@@ -61,8 +61,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('default', response.id); | ||
assert.same(client, response.request.originator); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should override the client configured into the interceptor by default': function (done) { | ||
'should override the client configured into the interceptor by default': function () { | ||
var theInterceptor, client; | ||
@@ -73,8 +73,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(otherClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('other', response.id); | ||
assert.same(client, response.request.originator); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the request phase': function (done) { | ||
'should intercept the request phase': function () { | ||
var theInterceptor, client; | ||
@@ -88,7 +88,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('request', response.request.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the request phase and handle a promise': function (done) { | ||
'should intercept the request phase and handle a promise': function () { | ||
var theInterceptor, client; | ||
@@ -104,8 +104,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('default', response.id); | ||
assert.same('request', response.request.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the request phase and handle a rejected promise': function (done) { | ||
'should intercept the request phase and handle a rejected promise': function () { | ||
var theInterceptor, client; | ||
@@ -119,3 +119,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -128,5 +128,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the response phase': function (done) { | ||
'should intercept the response phase': function () { | ||
var theInterceptor, client; | ||
@@ -140,7 +140,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('response', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the response phase and handle a promise': function (done) { | ||
'should intercept the response phase and handle a promise': function () { | ||
var theInterceptor, client; | ||
@@ -156,7 +156,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('response', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the response phase and handle a rejceted promise': function (done) { | ||
'should intercept the response phase and handle a rejceted promise': function () { | ||
var theInterceptor, client; | ||
@@ -170,3 +170,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -176,5 +176,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the response phase for an error': function (done) { | ||
'should intercept the response phase for an error': function () { | ||
var theInterceptor, client; | ||
@@ -188,3 +188,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -194,5 +194,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the response phase for an error and handle a promise maintaining the error': function (done) { | ||
'should intercept the response phase for an error and handle a promise maintaining the error': function () { | ||
var theInterceptor, client; | ||
@@ -206,3 +206,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -212,5 +212,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the response phase for an error and handle a rejected promise maintaining the error': function (done) { | ||
'should intercept the response phase for an error and handle a rejected promise maintaining the error': function () { | ||
var theInterceptor, client; | ||
@@ -224,3 +224,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -230,5 +230,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the success phase': function (done) { | ||
'should intercept the success phase': function () { | ||
var theInterceptor, client; | ||
@@ -243,7 +243,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('success', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the success phase and handle a promise': function (done) { | ||
'should intercept the success phase and handle a promise': function () { | ||
var theInterceptor, client; | ||
@@ -260,7 +260,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('success', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the success phase and handle a rejceted promise': function (done) { | ||
'should intercept the success phase and handle a rejceted promise': function () { | ||
var theInterceptor, client; | ||
@@ -275,3 +275,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -281,5 +281,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should intercept the error phase': function (done) { | ||
'should intercept the error phase': function () { | ||
var theInterceptor, client; | ||
@@ -294,7 +294,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('error', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the error phase and handle a promise': function (done) { | ||
'should intercept the error phase and handle a promise': function () { | ||
var theInterceptor, client; | ||
@@ -309,7 +309,7 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('error', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should intercept the error phase and handle a rejceted promise': function (done) { | ||
'should intercept the error phase and handle a rejceted promise': function () { | ||
var theInterceptor, client; | ||
@@ -324,3 +324,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(errorClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -330,5 +330,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should pass interceptor config to handlers': function (done) { | ||
'should pass interceptor config to handlers': function () { | ||
var theInterceptor, client, theConfig; | ||
@@ -351,8 +351,8 @@ theConfig = { foo: 'bar' }; | ||
client = theInterceptor(defaultClient, theConfig); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('request', response.request.phase); | ||
assert.same('response', response.phase); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should share context between handlers that is unique per request': function (done) { | ||
'should share context between handlers that is unique per request': function () { | ||
var theInterceptor, client, count, counted; | ||
@@ -375,3 +375,3 @@ count = 0; | ||
client = theInterceptor(defaultClient); | ||
when.all([client(), client(), client()]).then(function () { | ||
return when.all([client(), client(), client()]).then(function () { | ||
assert.same(3, counted.length); | ||
@@ -383,5 +383,5 @@ assert(counted.indexOf(1) >= 0); | ||
assert(counted.indexOf(3) >= 0); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the client provided by a ComplexRequest': function (done) { | ||
'should use the client provided by a ComplexRequest': function () { | ||
var theInterceptor, client; | ||
@@ -397,8 +397,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('default', response.id); | ||
assert.same(client, response.request.originator); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the repsponse provided by a ComplexRequest': function (done) { | ||
'should use the repsponse provided by a ComplexRequest': function () { | ||
var theInterceptor, client; | ||
@@ -413,8 +413,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('complex-response', response.id); | ||
assert.same(client, response.request.originator); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should cancel requests with the abort trigger provided by a ComplexRequest': function (done) { | ||
'should cancel requests with the abort trigger provided by a ComplexRequest': function () { | ||
var theInterceptor, client; | ||
@@ -431,3 +431,3 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(unresponsiveClient); | ||
client().then( | ||
return client().then( | ||
fail, | ||
@@ -438,5 +438,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should have access to the client in the response handlers for subsequent requests': function (done) { | ||
'should have access to the client in the response handlers for subsequent requests': function () { | ||
var theInterceptor, client; | ||
@@ -450,8 +450,8 @@ theInterceptor = interceptor({ | ||
client = theInterceptor(defaultClient); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same(client, response.client); | ||
assert.same('default', response.id); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should initialize the config object, without modifying the provided object': function (done) { | ||
'should initialize the config object, without modifying the provided object': function () { | ||
var theConfig, theInterceptor, client; | ||
@@ -482,7 +482,7 @@ theConfig = { foo: 'bar' }; | ||
client = theInterceptor(defaultClient, theConfig); | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same('request', response.request.phase); | ||
assert.same('response', response.phase); | ||
assert.same('default', response.id); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -489,0 +489,0 @@ 'should have the default client as the parent by default': function () { |
@@ -25,3 +25,3 @@ /* | ||
buster.testCase('rest/interceptor/basicAuth', { | ||
'should authenticate the requst from the config': function (done) { | ||
'should authenticate the requst from the config': function () { | ||
var client = basicAuth( | ||
@@ -31,21 +31,21 @@ function (request) { return { request: request }; }, | ||
); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('Basic dXNlcjpwYXNz', response.request.headers.Authorization); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should authenticate the requst from the request': function (done) { | ||
'should authenticate the requst from the request': function () { | ||
var client = basicAuth( | ||
function (request) { return { request: request }; } | ||
); | ||
client({ username: 'user', password: 'pass'}).then(function (response) { | ||
return client({ username: 'user', password: 'pass'}).then(function (response) { | ||
assert.equals('Basic dXNlcjpwYXNz', response.request.headers.Authorization); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not authenticate without a username': function (done) { | ||
'should not authenticate without a username': function () { | ||
var client = basicAuth( | ||
function (request) { return { request: request }; } | ||
); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
refute.defined(response.request.headers.Authorization); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -52,0 +52,0 @@ 'should have the default client as the parent by default': function () { |
@@ -29,75 +29,75 @@ /* | ||
buster.testCase('rest/interceptor/defaultRequest', { | ||
'should do nothing by default': function (done) { | ||
'should do nothing by default': function () { | ||
var client = defaultRequest(defaultClient); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.same(client, response.request.originator); | ||
delete response.request.originator; | ||
assert.equals({}, response.request); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should default the method': function (done) { | ||
'should default the method': function () { | ||
var client = defaultRequest(defaultClient, { method: 'PUT' }); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('PUT', response.request.method); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not overwrite the method': function (done) { | ||
'should not overwrite the method': function () { | ||
var client = defaultRequest(defaultClient, { method: 'PUT' }); | ||
client({ method: 'GET' }).then(function (response) { | ||
return client({ method: 'GET' }).then(function (response) { | ||
assert.equals('GET', response.request.method); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should default the path': function (done) { | ||
'should default the path': function () { | ||
var client = defaultRequest(defaultClient, { path: '/foo' }); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('/foo', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not overwrite the path': function (done) { | ||
'should not overwrite the path': function () { | ||
var client = defaultRequest(defaultClient, { path: '/foo' }); | ||
client({ path: '/bar' }).then(function (response) { | ||
return client({ path: '/bar' }).then(function (response) { | ||
assert.equals('/bar', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should default params': function (done) { | ||
'should default params': function () { | ||
var client = defaultRequest(defaultClient, { params: { foo: 'bar', bool: 'false' } }); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('bar', response.request.params.foo); | ||
assert.equals('false', response.request.params.bool); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should merge params': function (done) { | ||
'should merge params': function () { | ||
var client = defaultRequest(defaultClient, { params: { foo: 'bar', bool: 'false' } }); | ||
client({ params: { bool: 'true', bleep: 'bloop' } }).then(function (response) { | ||
return client({ params: { bool: 'true', bleep: 'bloop' } }).then(function (response) { | ||
assert.equals('bar', response.request.params.foo); | ||
assert.equals('true', response.request.params.bool); | ||
assert.equals('bloop', response.request.params.bleep); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should default headers': function (done) { | ||
'should default headers': function () { | ||
var client = defaultRequest(defaultClient, { headers: { foo: 'bar', bool: 'false' } }); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('bar', response.request.headers.foo); | ||
assert.equals('false', response.request.headers.bool); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should merge headers': function (done) { | ||
'should merge headers': function () { | ||
var client = defaultRequest(defaultClient, { headers: { foo: 'bar', bool: 'false' } }); | ||
client({ headers: { bool: 'true', bleep: 'bloop' } }).then(function (response) { | ||
return client({ headers: { bool: 'true', bleep: 'bloop' } }).then(function (response) { | ||
assert.equals('bar', response.request.headers.foo); | ||
assert.equals('true', response.request.headers.bool); | ||
assert.equals('bloop', response.request.headers.bleep); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should default the entity': function (done) { | ||
'should default the entity': function () { | ||
var client = defaultRequest(defaultClient, { entity: Math }); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.same(Math, response.request.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not overwrite the entity': function (done) { | ||
'should not overwrite the entity': function () { | ||
var client = defaultRequest(defaultClient, { entity: Math }); | ||
client({ entity: Date }).then(function (response) { | ||
return client({ entity: Date }).then(function (response) { | ||
assert.same(Date, response.request.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -104,0 +104,0 @@ 'should have the default client as the parent by default': function () { |
@@ -25,3 +25,3 @@ /* | ||
buster.testCase('rest/interceptor/entity', { | ||
'should return the response entity': function (done) { | ||
'should return the response entity': function () { | ||
var client, body; | ||
@@ -32,7 +32,7 @@ | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same(body, response); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should return the whole response if there is no entity': function (done) { | ||
'should return the whole response if there is no entity': function () { | ||
var client, response; | ||
@@ -43,5 +43,5 @@ | ||
client().then(function (r) { | ||
return client().then(function (r) { | ||
assert.same(response, r); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -48,0 +48,0 @@ 'should have the default client as the parent by default': function () { |
@@ -26,15 +26,15 @@ /* | ||
buster.testCase('rest/interceptor/errorCode', { | ||
'should resolve for less than 400 by default': function (done) { | ||
'should resolve for less than 400 by default': function () { | ||
var client = errorCode( | ||
function () { return { status: { code: 399 } }; } | ||
); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals(399, response.status.code); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should reject for 400 or greater by default': function (done) { | ||
'should reject for 400 or greater by default': function () { | ||
var client = errorCode( | ||
function () { return { status: { code: 400 } }; } | ||
); | ||
client({}).then( | ||
return client({}).then( | ||
fail, | ||
@@ -44,5 +44,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should reject lower then 400 with a custom code': function (done) { | ||
'should reject lower then 400 with a custom code': function () { | ||
var client = errorCode( | ||
@@ -52,3 +52,3 @@ function () { return { status: { code: 300 } }; }, | ||
); | ||
client({}).then( | ||
return client({}).then( | ||
fail, | ||
@@ -58,3 +58,3 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
@@ -61,0 +61,0 @@ 'should have the default client as the parent by default': function () { |
@@ -51,3 +51,3 @@ /* | ||
'should parse links in the entity': function (done) { | ||
'should parse links in the entity': function () { | ||
var client, body, parent, self; | ||
@@ -61,8 +61,8 @@ | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same(parent, response.entity._links.parentLink); | ||
assert.same(self, response.entity._links.selfLink); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should parse links in the entity into the entity': function (done) { | ||
'should parse links in the entity into the entity': function () { | ||
var client, body, parent, self; | ||
@@ -76,8 +76,8 @@ | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
assert.same(parent, response.entity.parentLink); | ||
assert.same(self, response.entity.selfLink); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should create a client for the related resource': function (done) { | ||
'should create a client for the related resource': function () { | ||
var client, body, parent, self; | ||
@@ -91,3 +91,3 @@ | ||
client().then(function (response) { | ||
return client().then(function (response) { | ||
var parentClient = response.entity._links.clientFor('parent', function (request) { return { request: request }; }); | ||
@@ -97,7 +97,7 @@ return parentClient().then(function (response) { | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should fetch a related resource': { | ||
requiresSupportFor: { 'ES5 getters': supports['ES5 getters'] }, | ||
'': function (done) { | ||
'': function () { | ||
var client, parentClient; | ||
@@ -112,3 +112,3 @@ | ||
client({ path: '/' }).then(function (response) { | ||
return client({ path: '/' }).then(function (response) { | ||
assert.same('/', response.request.path); | ||
@@ -120,3 +120,3 @@ assert.same('/', response.entity._links.selfLink.href); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -123,0 +123,0 @@ }, |
@@ -40,16 +40,16 @@ /* | ||
requiresSupportFor: { 'xdr': xdr, 'not-xhrCors': !xhrCors }, | ||
'should use the XDomainRequest engine for cross domain requests': function (done) { | ||
client({ path: 'http://example.com' }).then(function (response) { | ||
'should use the XDomainRequest engine for cross domain requests': function () { | ||
return client({ path: 'http://example.com' }).then(function (response) { | ||
assert.same('xdr', response.client); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the standard engine for same domain requests, with absolute paths': function (done) { | ||
client({ path: window.location.toString() }).then(function (response) { | ||
'should use the standard engine for same domain requests, with absolute paths': function () { | ||
return client({ path: window.location.toString() }).then(function (response) { | ||
assert.same('default', response.client); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the standard engine for same domain requests, with relative paths': function (done) { | ||
client({ path: '/' }).then(function (response) { | ||
'should use the standard engine for same domain requests, with relative paths': function () { | ||
return client({ path: '/' }).then(function (response) { | ||
assert.same('default', response.client); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -59,6 +59,6 @@ }, | ||
requiresSupportForAny: { 'not-xdr': !xdr, 'xhrCors': xhrCors }, | ||
'should always use the standard engine': function (done) { | ||
client({ path: 'http://example.com' }).then(function (response) { | ||
'should always use the standard engine': function () { | ||
return client({ path: 'http://example.com' }).then(function (response) { | ||
assert.same('default', response.client); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -65,0 +65,0 @@ }, |
@@ -32,7 +32,7 @@ /* | ||
requiresSupportFor: { xhr: !!XMLHttpRequest }, | ||
'': function (done) { | ||
'': function () { | ||
var client = xhr(defaultClient); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.same(XMLHttpRequest, response.request.engine); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -43,8 +43,8 @@ }, | ||
requiresSupportFor: { xhr: !XMLHttpRequest }, | ||
'': function (done) { | ||
'': function () { | ||
var client = xhr(defaultClient); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
refute.same(XMLHttpRequest, response.request.engine); | ||
assert.same('function', typeof response.request.engine); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -51,0 +51,0 @@ }, |
@@ -27,3 +27,3 @@ /* | ||
buster.testCase('rest/interceptor/jsonp', { | ||
'should include callback info from config in request by default': function (done) { | ||
'should include callback info from config in request by default': function () { | ||
var client = jsonp( | ||
@@ -33,8 +33,8 @@ function (request) { return when({ request: request }); }, | ||
); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('callback', response.request.callback.param); | ||
assert.equals('jsonp', response.request.callback.prefix); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should include callback info from request overridding config values': function (done) { | ||
'should include callback info from request overridding config values': function () { | ||
var client = jsonp( | ||
@@ -44,6 +44,6 @@ function (request) { return when({ request: request }); }, | ||
); | ||
client({ callback: { param: 'customCallback', prefix: 'customPrefix' } }).then(function (response) { | ||
return client({ callback: { param: 'customCallback', prefix: 'customPrefix' } }).then(function (response) { | ||
assert.equals('customCallback', response.request.callback.param); | ||
assert.equals('customPrefix', response.request.callback.prefix); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -50,0 +50,0 @@ 'should have the jsonp client as the parent by default': function () { |
@@ -25,3 +25,3 @@ /* | ||
buster.testCase('rest/interceptor/location', { | ||
'should follow the location header': function (done) { | ||
'should follow the location header': function () { | ||
var client, spy; | ||
@@ -36,3 +36,3 @@ spy = this.spy(function (request) { | ||
client = location(spy); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
refute(response.headers.Location); | ||
@@ -47,12 +47,12 @@ assert.same(3, spy.callCount); | ||
refute(spy.returnValues[2].headers.Location); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should return the response if there is no location header': function (done) { | ||
'should return the response if there is no location header': function () { | ||
var client, spy; | ||
spy = this.spy(function () { return { status: { code: 200 } }; }); | ||
client = location(spy); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals(200, response.status.code); | ||
assert.same(1, spy.callCount); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -59,0 +59,0 @@ 'should have the default client as the parent by default': function () { |
@@ -27,3 +27,3 @@ /* | ||
buster.testCase('rest/interceptor/mime', { | ||
'should return the response entity decoded': function (done) { | ||
'should return the response entity decoded': function () { | ||
var client; | ||
@@ -35,7 +35,7 @@ | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals({}, response.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should encode the request entity': function (done) { | ||
'should encode the request entity': function () { | ||
var client; | ||
@@ -50,7 +50,7 @@ | ||
client({ entity: {} }).then(function (response) { | ||
return client({ entity: {} }).then(function (response) { | ||
assert.equals('{}', response.request.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should encode the request entity from the Content-Type of the request, ignoring the filter config': function (done) { | ||
'should encode the request entity from the Content-Type of the request, ignoring the filter config': function () { | ||
var client; | ||
@@ -65,9 +65,9 @@ | ||
client({ entity: {}, headers: { 'Content-Type': 'application/json' } }).then(function (response) { | ||
return client({ entity: {}, headers: { 'Content-Type': 'application/json' } }).then(function (response) { | ||
assert.equals('{}', response.request.entity); | ||
assert.equals('application/json', response.request.headers['Content-Type']); | ||
assert.equals(0, response.request.headers.Accept.indexOf('application/json')); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not overwrite the requests Accept header': function (done) { | ||
'should not overwrite the requests Accept header': function () { | ||
var client; | ||
@@ -82,9 +82,9 @@ | ||
client({ entity: {}, headers: { Accept: 'foo' } }).then(function (response) { | ||
return client({ entity: {}, headers: { Accept: 'foo' } }).then(function (response) { | ||
assert.equals('{}', response.request.entity); | ||
assert.equals('application/json', response.request.headers['Content-Type']); | ||
assert.equals('foo', response.request.headers.Accept); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should error the request if unable to find a converter for the desired mime': function (done) { | ||
'should error the request if unable to find a converter for the desired mime': function () { | ||
var client, request; | ||
@@ -95,3 +95,3 @@ | ||
request = { headers: { 'Content-Type': 'application/vnd.com.example' }, entity: {} }; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -102,5 +102,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should use text/plain converter for a response if unable to find a converter for the desired mime': function (done) { | ||
'should use text/plain converter for a response if unable to find a converter for the desired mime': function () { | ||
var client; | ||
@@ -112,7 +112,7 @@ | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.same('{}', response.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the configured mime registry': function (done) { | ||
'should use the configured mime registry': function () { | ||
var client, customRegistry; | ||
@@ -137,3 +137,3 @@ | ||
client({ entity: 'request entity' }).then(function (response) { | ||
return client({ entity: 'request entity' }).then(function (response) { | ||
assert.equals('application/vnd.com.example', response.request.headers['Content-Type']); | ||
@@ -143,3 +143,3 @@ assert.equals('write: request entity', response.request.entity); | ||
assert.equals('read: response entity', response.entity); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -146,0 +146,0 @@ 'should have the default client as the parent by default': function () { |
@@ -26,3 +26,3 @@ /* | ||
buster.testCase('rest/interceptor/oAuth', { | ||
'should authenticate the request for a known token': function (done) { | ||
'should authenticate the request for a known token': function () { | ||
var client; | ||
@@ -35,7 +35,7 @@ | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('bearer abcxyz', response.request.headers.Authorization); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use implicit flow to authenticate the request': function (done) { | ||
'should use implicit flow to authenticate the request': function () { | ||
var client, windowStrategy, windowStrategyClose, oAuthCallbackName; | ||
@@ -69,6 +69,6 @@ | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals('bearer abcxyz', response.request.headers.Authorization); | ||
assert.called(windowStrategyClose); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -75,0 +75,0 @@ 'should have the default client as the parent by default': function () { |
@@ -25,3 +25,3 @@ /* | ||
buster.testCase('rest/interceptor/pathPrefix', { | ||
'should prepend prefix before path': function (done) { | ||
'should prepend prefix before path': function () { | ||
var client = pathPrefix( | ||
@@ -31,7 +31,7 @@ function (request) { return { request: request }; }, | ||
); | ||
client({ path: '/bar' }).then(function (response) { | ||
return client({ path: '/bar' }).then(function (response) { | ||
assert.equals('/foo/bar', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should prepend prefix before path, adding slash between path segments': function (done) { | ||
'should prepend prefix before path, adding slash between path segments': function () { | ||
var client = pathPrefix( | ||
@@ -41,7 +41,7 @@ function (request) { return { request: request }; }, | ||
); | ||
client({ path: 'bar' }).then(function (response) { | ||
return client({ path: 'bar' }).then(function (response) { | ||
assert.equals('/foo/bar', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should prepend prefix before path, not adding extra slash between path segments': function (done) { | ||
'should prepend prefix before path, not adding extra slash between path segments': function () { | ||
var client = pathPrefix( | ||
@@ -51,7 +51,7 @@ function (request) { return { request: request }; }, | ||
); | ||
client({ path: 'bar' }).then(function (response) { | ||
return client({ path: 'bar' }).then(function (response) { | ||
assert.equals('/foo/bar', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not prepend prefix before a fully qualified path': function (done) { | ||
'should not prepend prefix before a fully qualified path': function () { | ||
var client = pathPrefix( | ||
@@ -61,5 +61,5 @@ function (request) { return { request: request }; }, | ||
); | ||
client({ path: 'http://www.example.com/' }).then(function (response) { | ||
return client({ path: 'http://www.example.com/' }).then(function (response) { | ||
assert.equals('http://www.example.com/', response.request.path); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -66,0 +66,0 @@ 'should have the default client as the parent by default': function () { |
@@ -20,3 +20,3 @@ /* | ||
var interceptor, retry, rest, when, delay, clock, timeout; | ||
var interceptor, retry, rest, when, delay, clock, nextTick; | ||
@@ -30,6 +30,14 @@ interceptor = require('rest/interceptor'); | ||
// retain access to the native setTimeout function | ||
timeout = setTimeout; | ||
nextTick = (function (setTimeout) { | ||
return process && process.nextTick ? | ||
function (work) { | ||
process.nextTick(work); | ||
} : | ||
function (work) { | ||
setTimeout(work, 0); | ||
}; | ||
}(setTimeout)); | ||
buster.testCase('rest/interceptor/retry', { | ||
'should retry until successful': function (done) { | ||
'should retry until successful': function () { | ||
var count = 0, client = retry( | ||
@@ -45,5 +53,5 @@ function (request) { | ||
); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals(200, response.status.code); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
@@ -57,3 +65,3 @@ 'should accept custom config': { | ||
}, | ||
'': function (done) { | ||
'': function () { | ||
var count = 0, client, start, config; | ||
@@ -70,3 +78,3 @@ | ||
} else { | ||
timeout(function () { | ||
nextTick(function () { | ||
clock.tick(tick); | ||
@@ -80,11 +88,11 @@ }, 0); | ||
client({}).then(function (response) { | ||
return client({}).then(function (response) { | ||
assert.equals(200, response.status.code); | ||
assert.equals(count, 4); | ||
assert.equals(50, new Date().getTime() - start); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
}, | ||
'should not make propagate request if marked as canceled': function (done) { | ||
var parent, client, request; | ||
'should not make propagate request if marked as canceled': function () { | ||
var parent, client, request, response; | ||
@@ -97,3 +105,3 @@ parent = this.spy(function (request) { | ||
request = {}; | ||
client(request).then( | ||
response = client(request).then( | ||
fail, | ||
@@ -105,5 +113,6 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
request.canceled = true; | ||
request.canceled = true; | ||
return response; | ||
}, | ||
@@ -110,0 +119,0 @@ 'should have the default client as the parent by default': function () { |
@@ -57,7 +57,7 @@ /* | ||
buster.testCase('rest/interceptor/timeout', { | ||
'should resolve if client responds immediately': function (done) { | ||
'should resolve if client responds immediately': function () { | ||
var client, request; | ||
client = timeout(immediateClient, { timeout: 20 }); | ||
request = {}; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
@@ -69,19 +69,19 @@ refute(response.error); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should resolve if client responds before timeout': function (done) { | ||
'should resolve if client responds before timeout': function () { | ||
var client, request; | ||
client = timeout(delayedClient, { timeout: 100 }); | ||
request = {}; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
refute(response.error); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should reject even if client responds after timeout': function (done) { | ||
'should reject even if client responds after timeout': function () { | ||
var client, request; | ||
client = timeout(delayedClient, { timeout: 10 }); | ||
request = {}; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -93,9 +93,9 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should reject if client hanges': function (done) { | ||
'should reject if client hanges': function () { | ||
var client, request; | ||
client = timeout(hangClient, { timeout: 50 }); | ||
request = {}; | ||
client(request).then( | ||
return client(request).then( | ||
fail, | ||
@@ -107,29 +107,29 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
}, | ||
'should use request timeout value in perference to interceptor value': function (done) { | ||
'should use request timeout value in perference to interceptor value': function () { | ||
var client, request; | ||
client = timeout(delayedClient, { timeout: 10 }); | ||
request = { timeout: 0 }; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
refute(response.error); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not reject without a configured timeout value': function (done) { | ||
'should not reject without a configured timeout value': function () { | ||
var client, request; | ||
client = timeout(delayedClient); | ||
request = {}; | ||
client(request).then(function (response) { | ||
return client(request).then(function (response) { | ||
assert.same(request, response.request); | ||
refute(response.error); | ||
refute(request.canceled); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should cancel request if client support cancelation': function (done) { | ||
var client, request; | ||
'should cancel request if client support cancelation': function () { | ||
var client, request, response; | ||
client = timeout(cancelableClient, { timeout: 11 }); | ||
request = {}; | ||
client(request).then( | ||
response = client(request).then( | ||
fail, | ||
@@ -141,4 +141,5 @@ failOnThrow(function (response) { | ||
}) | ||
).ensure(done); | ||
); | ||
refute(request.canceled); | ||
return response; | ||
}, | ||
@@ -145,0 +146,0 @@ 'should have the default client as the parent by default': function () { |
@@ -28,17 +28,17 @@ /* | ||
}, | ||
'should discover unregisted converter': function (done) { | ||
registry.lookup('text/plain').then(function (converter) { | ||
'should discover unregisted converter': function () { | ||
return registry.lookup('text/plain').then(function (converter) { | ||
assert.isFunction(converter.read); | ||
assert.isFunction(converter.write); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should return registed converter': function (done) { | ||
'should return registed converter': function () { | ||
var converter = {}; | ||
registry.register('application/vnd.com.example', converter); | ||
registry.lookup('application/vnd.com.example').then(function (c) { | ||
return registry.lookup('application/vnd.com.example').then(function (c) { | ||
assert.same(converter, c); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should reject for non-existant converter': function (done) { | ||
registry.lookup('application/bogus').then( | ||
'should reject for non-existant converter': function () { | ||
return registry.lookup('application/bogus').then( | ||
fail, | ||
@@ -48,5 +48,5 @@ function () { | ||
} | ||
).ensure(done); | ||
); | ||
}, | ||
'should resolve converters from parent registries': function (done) { | ||
'should resolve converters from parent registries': function () { | ||
var child, converter; | ||
@@ -56,7 +56,7 @@ child = registry.child(); | ||
registry.register('application/vnd.com.example', converter); | ||
child.lookup('application/vnd.com.example').then(function (c) { | ||
return child.lookup('application/vnd.com.example').then(function (c) { | ||
assert.same(converter, c); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should override parent registries when registering in a child': function (done) { | ||
'should override parent registries when registering in a child': function () { | ||
var child, converterParent, converterChild; | ||
@@ -68,7 +68,7 @@ child = registry.child(); | ||
child.register('application/vnd.com.example', converterChild); | ||
child.lookup('application/vnd.com.example').then(function (c) { | ||
return child.lookup('application/vnd.com.example').then(function (c) { | ||
assert.same(converterChild, c); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should not have any side effects in a parent registry from a child': function (done) { | ||
'should not have any side effects in a parent registry from a child': function () { | ||
var child, converterParent, converterChild; | ||
@@ -80,5 +80,5 @@ child = registry.child(); | ||
child.register('application/vnd.com.example', converterChild); | ||
registry.lookup('application/vnd.com.example').then(function (c) { | ||
return registry.lookup('application/vnd.com.example').then(function (c) { | ||
assert.same(converterParent, c); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -85,0 +85,0 @@ }); |
@@ -27,3 +27,3 @@ /* | ||
buster.testCase('rest/wire', { | ||
'should use default client! config': function (done) { | ||
'should use default client! config': function () { | ||
var spec, client; | ||
@@ -37,9 +37,9 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
return spec.client({}).then(function (response) { | ||
assert.equals('bar', response.foo); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use client! config with entity interceptor disabled': function (done) { | ||
'should use client! config with entity interceptor disabled': function () { | ||
var spec, client; | ||
@@ -53,3 +53,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
return spec.client({ path: 'to/somewhere' }).then(function (response) { | ||
@@ -60,5 +60,5 @@ assert.equals('path/to/somewhere', response.request.path); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should be rejected for a server error status code': function (done) { | ||
'should be rejected for a server error status code': function () { | ||
var spec, client; | ||
@@ -72,3 +72,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then( | ||
return wire(spec, { require: require }).then( | ||
function (spec) { | ||
@@ -83,5 +83,5 @@ return spec.client({}).then( | ||
fail | ||
).ensure(done); | ||
); | ||
}, | ||
'should ignore status code when errorCode interceptor is disabled': function (done) { | ||
'should ignore status code when errorCode interceptor is disabled': function () { | ||
var spec, client; | ||
@@ -95,9 +95,9 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
return spec.client({}).then(function (response) { | ||
assert.equals('bar', response.foo); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should ignore Content-Type and entity when mime interceptor is disabled': function (done) { | ||
'should ignore Content-Type and entity when mime interceptor is disabled': function () { | ||
var spec, client; | ||
@@ -111,9 +111,9 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
return spec.client({}).then(function (response) { | ||
assert.isString(response); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use x-www-form-urlencoded as the default Content-Type for POSTs': function (done) { | ||
'should use x-www-form-urlencoded as the default Content-Type for POSTs': function () { | ||
var spec, client; | ||
@@ -127,3 +127,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
return spec.client({ method: 'post', entity: { bleep: 'bloop' } }).then(function (response) { | ||
@@ -134,6 +134,6 @@ assert.equals('bleep=bloop', response.request.entity); | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'should use the rest factory': { | ||
'': function (done) { | ||
'': function () { | ||
var spec, client; | ||
@@ -156,3 +156,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip().skip().skip()); | ||
@@ -166,5 +166,5 @@ spec.client({ method: 'post', path: '/', entity: { bleep: 'bloop' } }).then(function (response) { | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'with interceptor references': function (done) { | ||
'with interceptor references': function () { | ||
var spec, client; | ||
@@ -190,3 +190,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip().skip().skip()); | ||
@@ -200,5 +200,5 @@ spec.client({ method: 'post', path: '/', entity: { bleep: 'bloop' } }).then(function (response) { | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'with interceptor string shortcuts': function (done) { | ||
'with interceptor string shortcuts': function () { | ||
var spec, client; | ||
@@ -219,7 +219,7 @@ client = function () {}; | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip().skip().skip()); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'with concrete interceptors': function (done) { | ||
'with concrete interceptors': function () { | ||
var spec, client; | ||
@@ -240,3 +240,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip()); | ||
@@ -246,5 +246,5 @@ spec.client().then(function (response) { | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'using the default client': function (done) { | ||
'using the default client': function () { | ||
var spec; | ||
@@ -259,7 +259,7 @@ spec = { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(rest, spec.client.skip()); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'using a referenced parent client': function (done) { | ||
'using a referenced parent client': function () { | ||
var spec, client; | ||
@@ -281,7 +281,7 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip()); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
}, | ||
'without wiring interceptor configurations': function (done) { | ||
'without wiring interceptor configurations': function () { | ||
var spec, client; | ||
@@ -305,3 +305,3 @@ client = function (request) { | ||
}; | ||
wire(spec, { require: require }).then(function (spec) { | ||
return wire(spec, { require: require }).then(function (spec) { | ||
assert.same(client, spec.client.skip()); | ||
@@ -311,3 +311,3 @@ spec.client().then(function (response) { | ||
}); | ||
}).otherwise(fail).ensure(done); | ||
}).otherwise(fail); | ||
} | ||
@@ -314,0 +314,0 @@ } |
Sorry, the diff of this file is not supported yet
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
5998
288
293836
+ Addedwhen@3.0.0(transitive)
- Removedwhen@2.8.0(transitive)
Updatedwhen@>1.8.0 <=3.0.0