Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
Fix bug with missing endpointOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellmorten committed Sep 29, 2018
1 parent 3a9635e commit 01f8699
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/adapter/prepareEndpoint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ test('should merge with serviceOptions', (t) => {
t.deepEqual(ret, expected)
})

test('should use serviceOptions when no endpointOptions', (t) => {
const serviceOptions = {
uri: 'http://othersoap.com/', soap: { version: '1.2' }
}

const ret = prepareEndpoint(undefined, serviceOptions)

t.deepEqual(ret, serviceOptions)
})

test('should always return object', (t) => {
const ret = prepareEndpoint(null)

Expand Down
4 changes: 3 additions & 1 deletion lib/adapter/prepareEndpoint.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { mergeDeepRight } = require('ramda')

function prepareEndpoint (endpointOptions, serviceOptions) {
return mergeDeepRight(serviceOptions, endpointOptions)
return (endpointOptions)
? mergeDeepRight(serviceOptions, endpointOptions)
: serviceOptions || {}
}

module.exports = prepareEndpoint

0 comments on commit 01f8699

Please sign in to comment.