Skip to content
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

"Instant" format according to rfc1123-date1 #238

Merged
merged 2 commits into from
Jan 2, 2023

Conversation

braginxv
Copy link

To make http4s able to parse datetime values, the formatting of these values has to be done according to rfc1123-date1 with a leading zero for single-digit dates

@braginxv braginxv changed the title Instant format according to rfc1123-date1 "Instant" format according to rfc1123-date1 Dec 31, 2022
@@ -165,5 +165,8 @@ object Header {
}
def unsafeParseHttpDate(s: String): Instant = parseHttpDate(s).getOrThrow

def toHttpDateString(i: Instant): String = DateTimeFormatter.RFC_1123_DATE_TIME.format(i.atZone(GMT))
def toHttpDateString(instantTime: Instant): String = {
val pattern = DateTimeFormatter.ofPattern("EEE, dd LLL YYYY HH:mm:ss", Locale.US)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this can be a private constant, to avoid re-parsing the format every time?

@braginxv braginxv force-pushed the braginxv branch 2 times, most recently from 37536de to b893179 Compare January 1, 2023 10:27
@braginxv
Copy link
Author

braginxv commented Jan 2, 2023

fixes done

@adamw adamw merged commit 9a7ffaa into softwaremill:master Jan 2, 2023
@adamw
Copy link
Member

adamw commented Jan 2, 2023

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants