Feat(medusajs) Allow to pass custom headers (#1009)

* Feat(medusajs) Allow to pass custom headers

* fix: axios exprexted output

* fix: integration test cart

* refactor: Update types object > Record<string, any>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
Adrien de Peretti
2022-02-17 16:50:03 +01:00
committed by GitHub
co-authored by Sebastian Rindom
parent 449e666428
commit 22d387dcce
45 changed files with 572 additions and 433 deletions
+5 -5
View File
@@ -68,7 +68,7 @@ class Client {
}
// Stolen from https://github.com/stripe/stripe-node/blob/fd0a597064289b8c82f374f4747d634050739043/lib/utils.js#L282
normalizeHeaders(obj: object): object {
normalizeHeaders(obj: object): Record<string, any> {
if (!(obj && typeof obj === "object")) {
return obj
}
@@ -109,9 +109,9 @@ class Client {
userHeaders: RequestOptions,
method: RequestMethod,
path: string,
customHeaders: object = {}
customHeaders: Record<string, any> = {}
): AxiosRequestHeaders {
let defaultHeaders: object = {
let defaultHeaders: Record<string, any> = {
Accept: "application/json",
"Content-Type": "application/json",
}
@@ -183,9 +183,9 @@ class Client {
async request(
method: RequestMethod,
path: string,
payload: object = {},
payload: Record<string, any> = {},
options: RequestOptions = {},
customHeaders: object = {}
customHeaders: Record<string, any> = {}
): Promise<any> {
const reqOpts = {
method,