[swift-corelibs-dev] SR-6405: URLRequest does not capitalise HTTP methods

Stephen Celis stephen.celis at gmail.com
Thu Nov 16 11:41:42 CST 2017


Brandon Williams and I have come across a lot of inconsistencies between Foundations in our Swift web work. We’ve been trying to file bugs when we remember to, but I’m curious if there’s a better way to catch these. Is the Foundation test suite run against both implementations to attempt to catch these kinds of things? If not it would seem like a big win to do so. If so, I suppose we could help by beefing up the test coverage?

Stephen

> On Nov 16, 2017, at 12:18 PM, Ian Partridge via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> Hi, it looks like Foundation on Darwin capitalises certain HTTP
> methods but not others:
> 
> ```
> let methods = ["get", "head", "post", "put", "delete", "connect",
> "options", "trace", "patch"]
> 
> var x = URLRequest(url: URL(string: "/hello")!)
> 
> for m in methods {
>    x.httpMethod = m
>    print(x.httpMethod!)
> }
> ```
> 
> Output on Darwin:
> GET
> HEAD
> POST
> PUT
> DELETE
> CONNECT
> options
> trace
> patch
> 
> Currently on Linux we don't do any capitalization so I'd like to fix this.
> 
> Is my list of 6 methods above the definitive list of which HTTP
> methods should be capitalized?
> 
> Thanks,
> 
> -- 
> Ian Partridge
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev



More information about the swift-corelibs-dev mailing list