Skip to content

Commit

Permalink
Content type in JSON RPC response
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlopez committed Dec 8, 2020
1 parent c56ca5d commit 00a1558
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public class Web3ResultHttpResponseHandler extends SimpleChannelInboundHandler<W

@Override
protected void channelRead0(ChannelHandlerContext ctx, Web3Result msg) {
ctx.write(new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1,
HttpResponseStatus.valueOf(DefaultHttpStatusCodeProvider.INSTANCE.getHttpStatusCode(msg.getCode())),
msg.getContent()
)).addListener(ChannelFutureListener.CLOSE);
DefaultFullHttpResponse response = new DefaultFullHttpResponse(
HttpVersion.HTTP_1_1,
HttpResponseStatus.valueOf(DefaultHttpStatusCodeProvider.INSTANCE.getHttpStatusCode(msg.getCode())),
msg.getContent()
);

response.headers().add("Content-Type", "application/json");

ctx.write(response).addListener(ChannelFutureListener.CLOSE);
}

@Override
Expand Down

0 comments on commit 00a1558

Please # to comment.