Skip to content

Commit

Permalink
fix #465 Return full empty body message when 304 response code
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Oct 16, 2018
1 parent c9a3142 commit 84db86d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ protected void onOutboundError(Throwable err) {

@Override
protected HttpMessage outboundHttpMessage() {
return nettyResponse;
if (HttpResponseStatus.NOT_MODIFIED.equals(status())) {
return newFullEmptyBodyMessage();
}
else {
return nettyResponse;
}
}

final Mono<Void> withWebsocketSupport(String url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,12 @@ private void checkResponse(String url, InetSocketAddress address) {
.expectNextMatches(t -> {
int code = t.getT1();
HttpHeaders h = t.getT2();
if (code == 204 || code == 304) {
if (code == 204) {
return !h.contains("Transfer-Encoding") &&
!h.contains("Content-Length") &&
"NO BODY".equals(t.getT3());
}
else if (code == 205) {
else if (code == 205 || code == 304) {
return !h.contains("Transfer-Encoding") &&
h.getInt("Content-Length").equals(0) &&
"NO BODY".equals(t.getT3());
Expand Down

0 comments on commit 84db86d

Please sign in to comment.