You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in each route I have to write the following w.Header().Set("Content-Type", "application/javascript") at the beginning of every route. Is there a way to say: 'send this header before on each routes'?
P.S. thank you very much for excellent package.
The text was updated successfully, but these errors were encountered:
That's a bit outside of the scope of this package, but it's pretty easy to do by creating a small function to that will take a handler function as an argument and wrap the handler inside another function that writes the header and then calls the handler. Two ways of doing this are below:
I was aware of how to do this (still thank you for help). I thought that something like 'send all headers' already exist after seeing this api := router.NewGroup("/api/v1"), which is also can be achieved with a small function.
After looking through the package and not finding anything, I decided to ask you. Thank you very much for a reply.
Currently in each route I have to write the following
w.Header().Set("Content-Type", "application/javascript")
at the beginning of every route. Is there a way to say: 'send this header before on each routes'?P.S. thank you very much for excellent package.
The text was updated successfully, but these errors were encountered: