-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add optional headers in raw response
- Loading branch information
Showing
5 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
/* eslint-disable no-console */ | ||
// import commercelayer from '../lib/cjs' | ||
import commercelayer from '../src' | ||
import getToken from './token' | ||
|
||
|
||
(async () => { | ||
|
||
const organization = process.env.CL_SDK_ORGANIZATION || '' | ||
const accessToken = process.env.CL_SDK_ACCESS_TOKEN || '' | ||
const auth = await getToken('integration') | ||
const accessToken = auth? auth.accessToken : '' | ||
|
||
const cl = commercelayer({ | ||
organization, | ||
accessToken, | ||
timeout: 5000, | ||
}) | ||
|
||
const customer = await cl.customers.retrieve('OZqohRjoWn') | ||
const rrr = cl.addRawResponseReader({ headers: true }) | ||
|
||
const id = customer | ||
const customers = await cl.customers.list({ pageSize: 1 }) | ||
|
||
const cg = await cl.customers.customer_group(id) | ||
|
||
console.log(cg) | ||
|
||
if (!cg) console.log('No response!') | ||
console.log(rrr.rawResponse) | ||
console.log(rrr.headers) | ||
|
||
})() |