nordnet-next-api
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -220,3 +220,3 @@ 'use strict'; | ||
it('should set ntag header', function () { | ||
it('should set expected headers', function () { | ||
return (0, _chai.expect)(fetchSpy.args[1][1].headers).to.deep.equal({ 'Content-type': 'application/x-www-form-urlencoded', Accept: 'application/json', 'Accept-Language': 'sv', ntag: ntag }); | ||
@@ -231,2 +231,16 @@ }); | ||
}); | ||
describe('when making POST request with custom Content-type header', function () { | ||
beforeEach(settle(_index.post, '/next/2/user/lists/{list_id}/{instrument_id}', { list_id: 1, instrument_id: 101 }, { 'Accept-Language': 'sv', 'Content-type': 'application/json' })); | ||
it('should set expected headers', function () { | ||
return (0, _chai.expect)(fetchSpy.args[1][1].headers).to.deep.equal({ 'Content-type': 'application/json', Accept: 'application/json', 'Accept-Language': 'sv', ntag: ntag }); | ||
}); | ||
it('should set method \'post\'', function () { | ||
return (0, _chai.expect)(fetchSpy.args[1][1].method).to.equal('post'); | ||
}); | ||
it('should include credentials', function () { | ||
return (0, _chai.expect)(fetchSpy.args[1][1].credentials).to.equal('include'); | ||
}); | ||
}); | ||
}); | ||
@@ -233,0 +247,0 @@ |
@@ -200,5 +200,5 @@ 'use strict'; | ||
if (method === 'post' || method === 'put') { | ||
return _lodash2['default'].merge({ ntag: state.nTag }, headers, postDefaultHeaders); | ||
return _lodash2['default'].merge({ ntag: state.nTag }, postDefaultHeaders, headers); | ||
} else if (method === 'delete') { | ||
return _lodash2['default'].merge({ ntag: state.nTag }, headers, defaultHeaders); | ||
return _lodash2['default'].merge({ ntag: state.nTag }, defaultHeaders, headers); | ||
} | ||
@@ -205,0 +205,0 @@ |
{ | ||
"name": "nordnet-next-api", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Nordnet nExt API Javascript client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -182,3 +182,3 @@ import 'test-helper'; | ||
it('should set ntag header', () => | ||
it('should set expected headers', () => | ||
expect(fetchSpy.args[1][1].headers).to.deep.equal( | ||
@@ -189,2 +189,13 @@ { 'Content-type': 'application/x-www-form-urlencoded', Accept: 'application/json', 'Accept-Language': 'sv', ntag: ntag })); | ||
}); | ||
describe('when making POST request with custom Content-type header', () => { | ||
beforeEach(settle(post, '/next/2/user/lists/{list_id}/{instrument_id}', | ||
{ list_id: 1, instrument_id: 101}, { 'Accept-Language': 'sv', 'Content-type': 'application/json' })); | ||
it('should set expected headers', () => | ||
expect(fetchSpy.args[1][1].headers).to.deep.equal( | ||
{ 'Content-type': 'application/json', Accept: 'application/json', 'Accept-Language': 'sv', ntag: ntag })); | ||
it('should set method \'post\'', () => expect(fetchSpy.args[1][1].method).to.equal('post')); | ||
it('should include credentials', () => expect(fetchSpy.args[1][1].credentials).to.equal('include')); | ||
}); | ||
}); | ||
@@ -191,0 +202,0 @@ |
@@ -166,5 +166,5 @@ import es6Promise from 'es6-promise'; | ||
if (method === 'post' || method === 'put') { | ||
return _.merge({ ntag: state.nTag }, headers, postDefaultHeaders); | ||
return _.merge({ ntag: state.nTag }, postDefaultHeaders, headers); | ||
} else if (method === 'delete') { | ||
return _.merge({ ntag: state.nTag }, headers, defaultHeaders); | ||
return _.merge({ ntag: state.nTag }, defaultHeaders, headers); | ||
} | ||
@@ -171,0 +171,0 @@ |
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
45929
999