-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
There is a major bug: the status code can get ignored, doesn't handle 3xx and is not available to client code.
- Redirects are not handled.
- Conditional requests are impossible.
- Depending on usage, client or server errors can get ignored.
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
def GET[A](url: String)(implicit rds: HttpReads[A], hc: HeaderCarrier): Future[A] =
withTracing(GET_VERB, url) {
val httpResponse = doGet(url)
executeHooks(url, GET_VERB, None, httpResponse)
mapErrors(GET_VERB, url, httpResponse).map(response => rds.read(GET_VERB, url, response))
}
should probably be more like
def GET[A](url: String)(implicit rds: HttpReads[A], hc: HeaderCarrier):
Future[Either[HttpResponse, A]] =
withTracing(GET_VERB, url) {
val httpResponse = doGet(url)
executeHooks(url, GET_VERB, None, httpResponse)
mapErrors(GET_VERB, url, httpResponse).<... rewrite this ...>
}
The same applies to the other methods, POST, PUT etc.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels