Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
after(function() {
if (isNodeJs() && testServer) {
testServer.stop();
}
// de-register HAL plug-in to leave Traverson in a clean state for other
// tests
traverson.registerMediaType(JsonHalAdapter.mediaType, null);
});
after(function() {
// de-register HAL plug-in to leave Traverson in a clean state for other
// tests
traverson.registerMediaType(JsonHalAdapter.mediaType, null);
});
after(function() {
// de-register HAL plug-in to leave Traverson in a clean state for other
// tests
traverson.registerMediaType(JsonHalAdapter.mediaType, null);
});
describe('Content negotiation', function() {
var api
, callback
, firstUri
, get
, mockResponse
, rootResponse
, rootUri = 'http://api.io'
, client = traverson.from(rootUri)
, secondResponse
, secondUri
, thirdResponse;
before(function() {
traverson.registerMediaType(JsonHalAdapter.mediaType, JsonHalAdapter);
});
after(function() {
// de-register HAL plug-in to leave Traverson in a clean state for other
// tests
traverson.registerMediaType(JsonHalAdapter.mediaType, null);
});
beforeEach(function() {
api = client.newRequest();
after(function() {
traverson.registerMediaType(JsonHalAdapter.mediaType, null);
});
before(function() {
traverson.registerMediaType(JsonHalAdapter.mediaType, JsonHalAdapter);
});
before(function() {
traverson.registerMediaType(JsonHalAdapter.mediaType, JsonHalAdapter);
api = traverson.from(rootUri).jsonHal();
});
before(function() {
if (isNodeJs()) {
testServer = require('traverson-test-server');
testServer.start();
}
traverson.registerMediaType(JsonHalAdapter.mediaType, JsonHalAdapter);
});
beforeEach(function() {
jsonHalApi = traverson
.from(rootUri)
.jsonHal()
.newRequest()
.withRequestOptions({
headers: {
'Accept': 'application/hal+json',
'Content-Type': 'application/json'
}
});
callback = sinon.spy();
});
before(function() {
traverson.registerMediaType(JsonHalAdapter.mediaType, JsonHalAdapter);
api = traverson.from(rootUri).jsonHal();
});