Skip to content

Commit

Permalink
Bug fix in RESTErrorHandler - adding the right content length in the …
Browse files Browse the repository at this point in the history
…response header
  • Loading branch information
Chinmay Soman committed Jun 14, 2013
1 parent 3f04f58 commit 74d71c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/java/voldemort/coordinator/RESTErrorHandler.java
Expand Up @@ -16,6 +16,7 @@

package voldemort.coordinator;

import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;
import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1;

Expand Down Expand Up @@ -50,6 +51,7 @@ public static void handleError(HttpResponseStatus status, MessageEvent e, String
response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8");
response.setContent(ChannelBuffers.copiedBuffer("Failure: " + status.toString() + ". "
+ message + "\r\n", CharsetUtil.UTF_8));
response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes());

// Write the response to the Netty Channel
e.getChannel().write(response);
Expand Down

0 comments on commit 74d71c9

Please sign in to comment.