Skip to content

Commit

Permalink
Remove incorrect instanceof checks (#85)
Browse files Browse the repository at this point in the history
Motivation:

The included instanceof checks were incorrect and not needed at all anyway.

Modifications:

Remove instanceof checks

Result:

Cleanup
  • Loading branch information
normanmaurer authored Aug 9, 2024
1 parent 1ba58a8 commit 57a7d43
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ private BinaryHttpConverter() { }
* @return the created request.
*/
public static BinaryHttpRequest convert(HttpRequest request, String scheme, String authority) {
if (request instanceof FullBinaryHttpRequest) {
return convert((FullHttpRequest) request, scheme, authority);
}
BinaryHttpHeaders headers = BinaryHttpHeaders.newHeaders(true);
copyAndSanitize(request.headers(), headers);

Expand Down Expand Up @@ -96,19 +93,17 @@ public static FullBinaryHttpRequest convert(FullHttpRequest request, String sche
* @return the created response.
*/
public static BinaryHttpResponse convert(HttpResponse response) {
if (response instanceof FullBinaryHttpRequest) {
return convert((FullHttpResponse) response);
}
BinaryHttpHeaders headers = BinaryHttpHeaders.newHeaders(true);
copyAndSanitize(response.headers(), headers);

BinaryHttpResponse binaryHttpResponse = new DefaultBinaryHttpResponse(
response.protocolVersion(), response.status(), headers);
binaryHttpResponse.setDecoderResult(response.decoderResult());
return binaryHttpResponse;
}

/**
* Creates a {@link FullBinaryHttpResponse} from the given {@link FullHttpRequest}.
* Creates a {@link FullBinaryHttpResponse} from the given {@link FullHttpResponse}.
* All {@link HttpHeaders} names of the {@link FullHttpResponse} will be changed to lowercase to be in line with
* the
* <a href="https://www.rfc-editor.org/rfc/rfc9292.html">Binary Representation of HTTP Messages</a> specification.
Expand Down

0 comments on commit 57a7d43

Please sign in to comment.