-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🚀 [Feature]: Cache-Control: no-cache #2159
Conversation
Check if the request header Cache-Control contains no-cache
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
@marcmartin13 thanks for the work can you tell me what is the difference of this function with the Next function? this can also be done with it or ? thought rather we integrate the fixed without possible change of functionality can you add more tests so we can make sure this functionality works and we don't have to manually test each time for minor adjustments |
1st: 2nd:
It will always return the cached entry (not yet expired) before reaching the Next function. 3rd: My workaround right now is to use skip middleware but I don't think it's a good practice. I've updated all of my comments because I don't understand my English 🤣 Thanks! |
Please update readme and create a PR for docs |
Hi @efectn, I'm sorry but where I can find it, and how to create PR for docs? Thank you |
https://github.com/gofiber/docs/tree/master/api/middleware you can take a look here |
Hi @ReneWerner87 and @efectn may I ask if is it ok to add one more feature?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure yet if we really should expose the RequestDirective method
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it to a normal private function.
Question: is updating readme and docs necessary since it is just a private function?
thanks!
No |
we could already describe the new behavior so that everyone knows when they use the middleware and don't have to look in the code, but maybe you already implicitly assume this behavior |
yep, you are right. but I don't know where to put the description of this function since readme and docs have only the config description. |
then just start with the first descriptions look at the other middlewares and copy the style or look where the description i |
on it |
@ReneWerner87 thanks for helping me |
thx for the contribution^^ |
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Added description for the PR gofiber/fiber#2159
Added noCache function for checking Cache-Control: no-cache in the request header
Description
If the request header contains Cache-Control: no-cache it will skip getting the cached entry and proceeds to cache the response.
Type of change
Checklist: