Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 2ad5d13

Browse files
authored
Merge release-v0.1.6 into master
2 parents 40e9dfb + f39481f commit 2ad5d13

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.1.6 (October 16, 2018)
2+
- Fix `overrideHttpPut` logic invocation
3+
14
## v0.1.5 (October 16, 2018)
25
- Add `overrideHttpPut` option for handling environments not allowing http put.
36

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commercecloud-ocapi-client",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "An ES6 JavaScript Client for Salesforce Open Commerce API",
55
"license": "SEE LICENSE IN LICENSE",
66
"main": "dist/commercecloud-ocapi-client.cjs.js",

src/ApiClient.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ export default class ApiClient {
421421
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
422422
returnType) {
423423

424+
// emulate PUT method because they are not allowed on staging and production environments
425+
if (this.overrideHttpPut && httpMethod.toUpperCase() === 'PUT') {
426+
httpMethod = 'POST'
427+
headerParams = Object.assign(headerParams || {}, {'x-dw-http-method-override': 'PUT'})
428+
}
429+
424430
const url = this.buildUrl(path, pathParams)
425431
const request = superagent(httpMethod, url)
426432

@@ -432,12 +438,6 @@ export default class ApiClient {
432438
queryParams._ = new Date().getTime()
433439
}
434440

435-
// emulate PUT method because they are not allowed on staging and production environments
436-
if (this.overrideHttpPut && httpMethod.toUpperCase() === 'PUT') {
437-
httpMethod = 'POST'
438-
headerParams = Object.assign(headerParams || {}, {'x-dw-http-method-override': 'PUT'})
439-
}
440-
441441
request.query(this.normalizeParams(queryParams))
442442

443443
// set header parameters

0 commit comments

Comments
 (0)