-
Notifications
You must be signed in to change notification settings - Fork 218
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: improve typed headers #625
Conversation
Marking this as draft as this is very early in development. I will gradually add everything I can, but it will take a good while. |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 77.83% 79.47% +1.64%
==========================================
Files 47 54 +7
Lines 4286 5346 +1060
Branches 611 675 +64
==========================================
+ Hits 3336 4249 +913
- Misses 933 1078 +145
- Partials 17 19 +2 β View full report in Codecov by Sentry. |
I believe this has covered everything in the scope of the PR. If I missed anything in any other function where it can be improved, please let me know and I'll gladly add it. There are a few things I would like to change, like the AnyType usage, but I do need a tiny bit of help in figuring out how to properly take care of multi-value parameter-included headers (like www-authenticate), especially when used inside strings as that could probably mitigate the use of AnyType entirely. That being said, I understand it can't be full-proof, and therefore I think this is good as a baseline intellisense. |
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.
Thanks!
(in summary made refactors to improve maintainability + relax types to only hint and still allow artibrary string/number as input)
Glad I can help! |
π Linked issue
β Type of change
π Description
This PR is something I thought about for a while. Since we have header intellisense, we might as well have value intellisense. This will ensure no wrong header values are set and would save time debugging header issues (a common example of this is the misconception that
image/jpg
is a valid content type, when in reality it doesn't have a universally acceptable type). Granted, this won't be a complete intellisense for all possible values as the value combinations can be endless, however it would give a good foundation.EDIT: As of today, I have decided to expand this further and include status codes (maybe something else as well)
π Checklist