code: private Status sendResponseHeaders(Status status) {
          // NOTE: Line 572-574 of CBL_Router.m is not in CBL Java Core
          //       This check is in sendResponse();
          connection.getResHeader().add("Server",
                  String.format(Locale.ENGLISH, "Couchbase Lite %s", getVersionString()));
  
          // When response body is not null, we can assume that the body is JSON:
          boolean hasJSONBody = connection.getResponseBody() != null;
          String contentType = hasJSONBody ? CONTENT_TYPE_JSON : null;
  
          // Check for a mismatch between the Accept request header and the response type:
          String accept = getRequestHeaderValue("Accept");
          if (accept != null && accept.indexOf("*/*") < 0) {
              String baseContentType = connection.getBaseContentType();
              if (baseContentType == null)
                  baseContentType = contentType;
              if (baseContentType != null && accept.indexOf(baseContentType) < 0) {
                  Log.w(TAG, "Error 406: Can't satisfy request Accept: %s (Content-Type = %s)",
                          accept, contentType);
  
                  // Reset response body:
                  connection.setResponseBody(null);
  
                  status = new Status(Status.NOT_ACCEPTABLE);
                  return status;
              }
          }
  
          if (contentType != null) {
              Header resHeader = connection.getResHeader();
              if (resHeader != null && resHeader.get("Content-Type") == null)
                  resHeader.add("Content-Type", contentType);
              else
                  Log.d(TAG, "Cannot add Content-Type header because getResHeader() returned null");
          }
  
          // NOTE: Line 596-607 of CBL_Router.m is not in CBL Java Core
          return status;
      }
docs: in CBL_Router.m
  - (void) sendResponseHeaders