Skip to content

Commit

Permalink
Use reason phrase from response (zalando#1320)
Browse files Browse the repository at this point in the history
Co-authored-by: Anders Jaensson <anders.jaensson@gmail.com>
  • Loading branch information
Anders Jaensson and andersjaensson authored Feb 22, 2023
1 parent 8093f80 commit 30b1676
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public int getStatus() {
return response.getCode();
}

@Override
public String getReasonPhrase(){
return response.getReasonPhrase();
}

@Override
public HttpHeaders getHeaders() {
HttpHeaders headers = HttpHeaders.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
final class RemoteResponseTest {

private final BasicHttpEntity entity = new BasicHttpEntity(new ByteArrayInputStream("Hello, world!".getBytes(UTF_8)), -1, ContentType.TEXT_PLAIN, "gzip", true);
private final BasicClassicHttpResponse delegate = new BasicClassicHttpResponse( 200, "OK");
private final BasicClassicHttpResponse delegate = new BasicClassicHttpResponse( 200, "Ok");
private final RemoteResponse unit = new RemoteResponse(delegate);

@BeforeEach
Expand Down Expand Up @@ -90,4 +90,9 @@ void shouldResolveProtocolVersion() throws IOException {

assertThat(unit.getProtocolVersion()).isEqualTo(HttpVersion.HTTP_1_1.toString());
}

@Test
void shouldPreserveCaseForReasonPhrase() {
assertThat(unit.getReasonPhrase()).isEqualTo("Ok");
}
}

0 comments on commit 30b1676

Please sign in to comment.