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

Decent way to use `parseRequest` with checked responses? #304

Open
mgsloan opened this issue Sep 28, 2017 · 4 comments
Open

Decent way to use `parseRequest` with checked responses? #304

mgsloan opened this issue Sep 28, 2017 · 4 comments

Comments

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Sep 28, 2017

The docs for parseRequest indicate that its checkResponse won't do anything. I looked around for a function to add the same checkResponse as used by parseUrlThrow, but couldn't find one. I'm thinking it makes sense to:

  • Add setRequestCheckStatus (opposite of setRequestIgnoreStatus), which adds the same status check as parseUrlThrow. Use this function in the definition of parseUrlThrow.
  • Add parseRequestThrow, which also uses setRequestCheckStatus.

Thoughts?

@mgsloan

This comment has been minimized.

Copy link
Contributor Author

@mgsloan mgsloan commented Sep 28, 2017

I suppose when using Network.HTTP.Client, the checkResponse field is available, though the haddocks make it look like a normal function. However, even in that case, the default status check doesn't seem to be available as a function.

Note that I'm mainly running into this in the context of https://www.stackage.org/haddock/lts-9.6/http-conduit-2.2.3.2/Network-HTTP-Simple.html , which should also export functions that support this.

@snoyberg

This comment has been minimized.

Copy link
Owner

@snoyberg snoyberg commented Sep 28, 2017

@mgsloan

This comment has been minimized.

Copy link
Contributor Author

@mgsloan mgsloan commented Sep 28, 2017

Cool, sounds good! PR incoming

Perhaps Network.HTTP.Simple should also re-export parseUrl / parseUrlThrow? Currently using that API alone there's no way to use the default status check

@snoyberg

This comment has been minimized.

Copy link
Owner

@snoyberg snoyberg commented Sep 28, 2017

mgsloan added a commit to mgsloan/http-client that referenced this issue Apr 21, 2018
mgsloan added a commit to mgsloan/http-client that referenced this issue Apr 23, 2018
mgsloan added a commit to mgsloan/http-client that referenced this issue Apr 24, 2018
snoyberg added a commit that referenced this issue Apr 24, 2018
Add more functions for throwing StatusCodeException #304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.