nordnet-next-api
Advanced tools
Comparing version 2.3.4 to 2.4.0
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _postJson = require('./post-json'); | ||
var _postJson2 = _interopRequireDefault(_postJson); | ||
var _ping = require('./ping'); | ||
@@ -35,3 +39,4 @@ | ||
postUserLists: _postUserLists2.default, | ||
postJson: _postJson2.default, | ||
ping: _ping2.default | ||
}; |
@@ -86,2 +86,3 @@ 'use strict'; | ||
describe('when making POST request with JSON payload', test(_expectations2.default.postUserSettings)); | ||
describe('when making POST JSON request', test(_expectations2.default.postJson)); | ||
}); |
@@ -11,2 +11,3 @@ 'use strict'; | ||
exports.post = post; | ||
exports.postJson = postJson; | ||
exports.put = put; | ||
@@ -70,2 +71,12 @@ exports.del = del; | ||
function postJson(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var merge = function merge(one, two) { | ||
return Object.assign({}, one, two); | ||
}; | ||
return post(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
} | ||
function put(url) { | ||
@@ -102,2 +113,3 @@ var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
post: post, | ||
postJson: postJson, | ||
put: put, | ||
@@ -104,0 +116,0 @@ del: del |
{ | ||
"name": "nordnet-next-api", | ||
"version": "2.3.4", | ||
"version": "2.4.0", | ||
"description": "Nordnet nExt API Javascript client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,2 +5,3 @@ import getInstrument from './get-instrument'; | ||
import postUserLists from './post-user-lists'; | ||
import postJson from './post-json'; | ||
import ping from './ping'; | ||
@@ -13,3 +14,4 @@ | ||
postUserLists, | ||
postJson, | ||
ping, | ||
}; |
@@ -54,2 +54,3 @@ import { initSandBox, respondWith, execute, expectations } from 'test-helper'; | ||
describe('when making POST request with JSON payload', test(tests.postUserSettings)); | ||
describe('when making POST JSON request', test(tests.postJson)); | ||
}); |
@@ -46,2 +46,7 @@ import es6Promise from 'es6-promise'; | ||
export function postJson(url, params = {}, headers = {}) { | ||
const merge = (one, two) => Object.assign({}, one, two); | ||
return post(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
} | ||
export function put(url, params = {}, headers = {}) { | ||
@@ -72,2 +77,3 @@ const options = { | ||
post, | ||
postJson, | ||
put, | ||
@@ -74,0 +80,0 @@ del, |
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
45054
38
1189