Closed OnlyForF1 closed 5 years ago
Nice! Could you add some tests?
We use https://github.com/swift-server/swift-nio-http-client now on master. I'm not sure if that package has the same problem, but it's worth checking.
This repo will likely be deprecated soon.
@tanner0101 I am aware of this and I'll fix it there too. For now I am using Vapor 3 so I prioritised fixing that. On first glance it looks like that repo is not affected, I might write some unit tests to ensure there are no regressions in the future. (The behaviour in this repo was a regression)
@0xTim I've added unit tests, I had to change the visibility of some sections from private to internal. Let me know what you think.
@OnlyForF1 ah, sorry, I didn't see that this was merging into 3
.
I've refactored the tests to use httpbin, and reverted the visibility changes.
Hey @OnlyForF1, you just merged a pull request, have a coin!
You now have 1 coins.
Vapor's HTTPClient implementation would previously always override the Host and User-Agent headers when sending a request to the server. At best this was undesired behaviour, at worst it would result in HTTP 400 Bad Request responses.
Now, default values will only be provided if Host or User-Agent headers were not already set.