-
Notifications
You must be signed in to change notification settings - Fork 42
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
HTTP status logic is inadequate #38
Comments
Rick - I think you're right that the status can be rather hard to get at, though it isn't ignored. The idea of http-verbs is that it translates non-2xx codes into typed exceptions, which can flow back up through your chain of futures, and either be handled by your application code or by an error handler in the default Global objects provided by microservice-bootstrap/frontend-bootstrap. Whilst So my plan was to improve this a lot with #17, which builds on the introduction of the Sadly, although it was merged, it never got released because of other project pressures. If it looks helpful we could resurrect it? |
The problem seems to be one that arises from trying too hard to do too much. If we were to separate the HTTP traffic from the unmarshalling into two separate API steps, it would make it much easier for client code to achieve what it needs to achieve in different response scenarios. It would avoid complex monads too. |
Also, the two implicit parameters caused me trouble.
I discovered it's possible to make requests without these set up correctly. Explicit parameters would prevent this, e.g. like this
|
There is a major bug: the status code can get ignored, doesn't handle 3xx and is not available to client code.
Typically, all you get back is a Jackson exception because the error page cannot be parsed; this is quite unsatisfactory.
For example in https://github.com/hmrc/http-verbs/blob/master/src/main/scala/uk/gov/hmrc/play/http/HttpGet.scala
should probably be more like
The same applies to the other methods, POST, PUT etc.
The text was updated successfully, but these errors were encountered: