http-client
http-client copied to clipboard
No easy function for (Text -> m Request) without taking method in the string
parseRequest is cool, but it optionally takes a method before the URL, which makes the "easy thing" allow for changing the method unexpectedly if given user input. This is surprising.
I wrote something like this:
parseRequest' :: MonadThrow m => Text -> m Request
parseRequest' uri =
requestFromURI
=<< maybe
(throwM . stringException $ "bad URI")
pure
(parseURI (unpack uri))
This is fine, but it's surprising that there's not a version of this in http-client, which probably allows for accidentally messing with methods in programs that don't check the URLs that go into parseRequest.