swift
swift copied to clipboard
Allow defining the format to parse `Last-Modified` headers
Problem: we are using the package to integrate with a swift server that returns the Last-Modified
header with UTC
TZ instead of GMT
.
This causes time.Parse(http.TimeFormat, res.Header.Get("Last-Modified"))
to fail, because the TZ should be GMT
instead of UTC
.
We have rolled-out a temporary with a custom http.RoundTripper
that fixes the headers. However, it will be nicer to be able to configure the time format for cases like this.
Would you be open to receive a PR that makes the time format configurable?
I understand is diverging from the specs, but the reality is sometimes implementors diverge from the spec and we have to adapt.
Thanks! Ernesto
By all means send a PR. If you put the time string in the Connection object and make an empty string do the right thing that would be perfect.