Skip to content

Commit

Permalink
update README example with enableTransformBody example
Browse files Browse the repository at this point in the history
  • Loading branch information
joeluong-sfcc committed May 7, 2024
1 parent 8993bb5 commit 7c3853d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,16 @@ const postResponse = await customApiHelper.callCustomEndpoint({
endpointPath: 'greeting',
apiName: 'e2e-tests',
},
// The body will be automatically formatted for 'Content-Type'
// 'application/json' and 'application/x-www-form-urlencoded',
// so an object can be passed
// When this flag is set to true, the request body will be automatically
// formatted in the expected format set by the 'Content-type' headers
// 'application/json' or 'application/x-www-form-urlencoded'
enableTransformBody: true,

// object can be passed since we have enableTransformBody set to true
body: { data: 'data' }
// if enableTransformBody is not set to true,
// we have to ensure the request body is correctly formatted
// body: JSON.stringify({ data: 'data' })
},
clientConfig: clientConfigExample,
rawResponse: false
Expand Down

0 comments on commit 7c3853d

Please sign in to comment.