Skip to content

Commit

Permalink
Fixed #1356
Browse files Browse the repository at this point in the history
  • Loading branch information
hideki committed Jul 15, 2016
1 parent a1b06b4 commit a5f26e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/couchbase/lite/router/Router.java
Expand Up @@ -115,6 +115,7 @@ private enum TDContentOptions {
private boolean waiting = false;
private URL source = null;
private Timer timer = null; // timer for heartbeat
private boolean dontOverwriteBody = false;

private final Object databaseChangesLongpollLock = new Object();

Expand Down Expand Up @@ -633,8 +634,8 @@ public void start() {

if (status.isSuccessful() &&
connection.getResponseBody() == null &&
connection.getResponseInputStream() == null &&
connection.getHeaderField("Content-Type") == null) {
connection.getHeaderField("Content-Type") == null &&
dontOverwriteBody == false) {
connection.setResponseBody(new Body("{\"ok\":true}".getBytes()));
}

Expand Down Expand Up @@ -2052,6 +2053,7 @@ public Status do_GET_Attachment(Database _db, String docID, String _attachmentNa
connection.getResHeader().add("Content-Encoding", "gzip");
}

dontOverwriteBody = true;
connection.setResponseInputStream(attachment.getContentInputStream());
return new Status(Status.OK);

Expand Down

0 comments on commit a5f26e4

Please sign in to comment.