feat(medusa-react,medusa-js): Allow custom headers (#4409)

* add support for passing custom headers to backend through medusa-js and medusa-react

* switch order of override of headers

* Create gentle-teachers-greet.md

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Lacey PeveyandOliver Windall Juhl authored and GitHub committed 2023-06-28 15:04:58 +02:00
1 parent 5a4580b6a8
commit fe25c8a91f
3 files changed
+13

No files matched your search

+4
View File
@@ -16,6 +16,7 @@ export interface Config {
maxRetries: number
apiKey?: string
publishableApiKey?: string
customHeaders?: Record<string, any>
}
export interface RequestOptions {
@@ -199,6 +200,9 @@ class Client {
options: RequestOptions = {},
customHeaders: Record<string, any> = {}
): Promise<any> {
customHeaders = { ...this.config.customHeaders, ...customHeaders }
const reqOpts = {
method,
withCredentials: true,