-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(medusajs) Allow to pass custom headers #1009
Feat(medusajs) Allow to pass custom headers #1009
Conversation
c3d821a
to
fa7917f
Compare
@oliverheaps could you have a look please ? It will avoid that we have to override all the method when using SSR |
Would it make sense to use |
Yes if it is accepted I can integrate it in that PR 🤘 |
@olivermrbl it's ready when you are ready 👍 |
Great! I'll be doing some testing tomorrow and then we can wrap it up 👍 |
Should work since this is the changes Ive made for my admin |
* 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>
* 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>
* 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>
* 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>
* 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>
The request client allow to pass an argument which correspond to the custom headers that consumer would like to add to the request.
When using the wrapping of the resource, the ability to set those headers is lost.
As a consumer, using nextJS, and wanting to take advantage of
getServerSideProps
I am not able to set the headers coming from the request and therefore unable to send an authenticated request.This is a huge constraint since the only other way is to rewrite the resources on my own just to add that parameters (which is already accepted by the request)
In order to fix that, the
customHeaders
has been added to all api method as an optional parameters (backward compatibility) and therefore a consumer is able to use the resrouces even ingetServerSideProps
which allow a big performance boost