larshelge opened a new pull request #237:
URL: https://github.com/apache/httpcomponents-core/pull/237
This PR adds shorthand convenience methods for the various status classes in
`StatusLine`. The purpose is to enable a more concise and shorter notation for
checking the class of the HTTP response status.
The main use-case is to easily detect whether a response is a client-side or
server-side error.
Currently you have to compare the status class with the inner `StatusClass`
enum which is slightly awkward:
```java
if (statusLine.getStatusClass() == StatusLine.StatusClass.CLIENT_ERROR) {
// Throw a client side error
}
```
With this patch, the comparison is more concise:
`if (statusLine.is4xxClientError) {
// Throw a client side error
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]