Skip to content

Commit c103269

Browse files
authored
Merge pull request #1357 from couchbase/feature/issue_1356
Fixed #1356 - default response body`{"ok":"true"}` is not returned.
2 parents a1b06b4 + a5f26e4 commit c103269

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/com/couchbase/lite/router/Router.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private enum TDContentOptions {
115115
private boolean waiting = false;
116116
private URL source = null;
117117
private Timer timer = null; // timer for heartbeat
118+
private boolean dontOverwriteBody = false;
118119

119120
private final Object databaseChangesLongpollLock = new Object();
120121

@@ -633,8 +634,8 @@ public void start() {
633634

634635
if (status.isSuccessful() &&
635636
connection.getResponseBody() == null &&
636-
connection.getResponseInputStream() == null &&
637-
connection.getHeaderField("Content-Type") == null) {
637+
connection.getHeaderField("Content-Type") == null &&
638+
dontOverwriteBody == false) {
638639
connection.setResponseBody(new Body("{\"ok\":true}".getBytes()));
639640
}
640641

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

2056+
dontOverwriteBody = true;
20552057
connection.setResponseInputStream(attachment.getContentInputStream());
20562058
return new Status(Status.OK);
20572059

0 commit comments

Comments
 (0)