Skip to content

Commit

Permalink
Merge pull request #17 from padilo/feature/send_500_in_body
Browse files Browse the repository at this point in the history
Send string Internal Server Error
  • Loading branch information
victuxbb committed Nov 25, 2015
2 parents 7c0baec + 59c1e33 commit eba0141
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public Observable<Void> handle(HttpServerRequest<ByteBuf> request,

logError(throwable, request);

return Observable.empty();
response.getHeaders().set(HttpHeaders.CONTENT_TYPE, "text/plain");
return response.writeStringAndFlush("Internal server error");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public void setUp() {
given(serializerManager.getSupportedMediaTypes())
.willReturn(ImmutableSet.of());

given(response.writeStringAndFlush(any()))
.willReturn(Observable.empty());

ArgumentCaptor<Throwable> throwableArgumentCaptor = ArgumentCaptor.forClass(Throwable.class);
given(errorHandler.handleError(eq(request), throwableArgumentCaptor.capture(), any()))
.willAnswer(invocation -> Observable.error(throwableArgumentCaptor.getValue()));
Expand Down

0 comments on commit eba0141

Please sign in to comment.