Repository navigation
Conversation
A response header is a str, an int or a datetime. A datetime goes as an HTTP-date in GMT in every header and needs a time zone. ResponseHeader[T] of another type fails on import, and set checks the value against T. The response header serializer registry and winter.web.initialization are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #347.
What
str(as is), anint(a number) or adatetime(an HTTP-date in GMT), the types HTTP has a format for. The format follows the type only: adatetimeis an HTTP-date inLast-Modifiedand inX-Updated-Atalike, no longer ISO 8601 in headers other thanLast-Modified.ResponseHeader[T]of another type raisesTypeErroron import: a UUID or an enum is set as astr(str(uid),status.value).setchecks the value againstT(closes the TODO of Add type validation for response headers #136): a bool or an enum is rejected even where it subclassesintorstr, and adatetimewithout a time zone raisesValueErrorinstead of being read as the server's local time.email.utils.format_datetime, which does not depend on the locale of the server, asstrftime('%a, %d %b …')did.response_headers_serializer,ResponseHeaderSerializer, both built-in serializers andwinter.web.initializationare gone. The headers of a response are strings from the moment they are set.MediaTypeobject into aResponseHeader[str]; it sets its string now.Why
The registry chose the format by the header name inside Winter, so the same
datetimecame out in two formats, and its fallbackstr()sentStatus.ACTIVEorTrueto clients without an error. HTTP defines strings, numbers and dates for header values, so a closed set of types covers what Winter can format, and every other type is built outside from public pieces throughstr.To be confirmed on the consumer: how many headers are set with values that are not strings, and which of them are datetimes in custom headers that change from ISO 8601 to HTTP-date.
🤖 Generated with Claude Code