-
Notifications
You must be signed in to change notification settings - Fork 649
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
Accept dictionary literals for HTTPHeaders #824
Conversation
Can one of the admins verify this patch? |
3 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Maybe you can close this as it is already in https://github.com/vapor/http/blob/master/Sources/HTTPKit/Message/HTTPHeaders.swift#L73. Be good if it made it up stream though. Vapor compiles with both conformances present. |
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, that works for me :)
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! That looks pretty much perfect. But we do need a (very simple) test though. One test is good enough but it's important to run this code.
I’ve pushed an amend with a test. The test is… untested. |
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! Lgtm
@swift-nio-bot test this please |
Thanks @weissi! |
Just an idea - be able to provide dictionary literals where an HTTPHeader struct is expected. I could add the conformance in an extension if you prefer.
Motivation:
A convenience/shorthand for developers.
Modifications:
Add conformance to ExpressibleByDictionaryLiteral along with implementation.
Result:
The following is would then be legal in Vapor: