akie
AAlokai
•Created by akie on 10/30/2023 in #🙋|general-help
How to extend getHeaders in @vue-storefront/magento-api
Thank you for looking into this, @skirianov . I appreciate your willingness to check with your engineers. Please take your time, and I'm looking forward to the answer whenever it's available. Your help is much appreciated!😄
3 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
I checked the code history and found this:
https://github.com/vuestorefront/magento2/pull/1365/commits
It shows that allows us to set customHeader in a single method or customQuery(),
But it seems that the global getHeaders method in magento-api lib is not covered?
It is fixed to set the request headers including: currency, store and token (Because I see that these fields exist in all request headers in the api ,And these fields do not exist in the printing of hooks) i am using this rep : storefront-nuxt2-magento2
Or am I confusing these two things?20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
thanks @skirianov 👍
it is functioning properly.
I can also print out the same result: showing that I have set the request header
I'm also listening for requests in the terminal of my local service (using HttpToolkit), however it doesn't seem to show up in the request information
20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
Thanks for your help @skirianov
I will try it again tomorrow
20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
I will continue to study how to add custom request headers and set dynamic values.😄
20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
As I learned, the request will be sent to the middleware and the internal Api-client (apollo) will be called to handle the request,
but my understanding is not enough at present to support me to try to modify the built-in header part.
I have mastered the coverage query. and custom interface + custom query
20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
It didn't have the desired effect🤔
I referred to what you mentioned: https://docs.vuestorefront.io/v2/integrate/extending-integrations.html ,to try calling hooks to modify request headers
I can modify my request args here, but request header doesn't seem feasible. 😵💫
{
name: 'custom header',
hooks:(req,res)=>{
console.log('hooks_req',req)
// todo
return {
beforeCreate: ({ configuration }) => configuration,
afterCreate: ({ configuration }) => configuration,
beforeCall: ({ configuration, callName, args }) => {
// update header?
return args
},
afterCall: ({ configuration, callName, args, response }) => response
}
}
}
Maybe I should try other methods to add [x-forwarded-for] in request header 💪20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
thanks, I will continue to investigate it in depth and come back to you when I encounter real doubts and difficulties. 👍
20 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
hey @skirianov ,
I'm using
@vue-storefront/magento-api
in my local Vue-Magento
project,
and I'd like to add global request headers, similar to adding 'store' and 'content-currency' in the 'getHeader' method in the lib. use apollo-client lib
Can you please guide me in the right direction? Thank you very much20 replies
AAlokai
•Created by akie on 8/23/2023 in #🙋|general-help
General question about get cmsblock in cmsPage
thanks @.rohrig 🤝 , I greatly appreciate your response and guidance! Your provided information has been very helpful to me. While there isn't built-in support at the moment, your reply has given me a clearer understanding of how to build this feature. I'll also keep an eye on the progress of the TidyCode team and look forward to their implementation. Thank you once again for your assistance!
3 replies
AAlokai
•Created by akie on 5/31/2023 in #🙋|general-help
About request log from middleware to magento
Thank you very much for your patience to answer, I wish you a happy life
6 replies
AAlokai
•Created by akie on 5/31/2023 in #🙋|general-help
About request log from middleware to magento
thank you @skirianov , Firstly, I would like to thank you for your swift response and suggestion regarding my previous inquiry. I've tried using HTTPToolkit as per your recommendation, however, it appears this tool primarily captures requests from the browser to Nuxt, which isn't exactly what I'm looking for. Of course it's a very good way to view
I am seeking to inspect the outbound requests from the middleware (the post-request portion), with the ultimate goal of obtaining the logs of the requests received by the backend at the time they are made. This will allow me to accurately modify the code in this portion to fit the needs of my project.
Could you please provide any guidance or point me in the right direction as to how I can accomplish this? Your expertise and insights would be highly appreciated.
Thank you for your time and consideration.💖
6 replies