test_class.file: mesos-rxjava-client/src/test/java/com/mesosphere/mesos/rx/java/ResponseUtilsTest.java
test_class.identifier: ResponseUtilsTest
test_case.body: @Test
      public void attemptToReadErrorResponse_noContentLength() throws Exception {
          final String errMsg = "some response";
          final byte[] bytes = errMsg.getBytes(StandardCharsets.UTF_8);
          final HttpClientResponse<ByteBuf> resp = response(Unpooled.copiedBuffer(bytes), (headers) ->
              headers.add("Content-Type", "text/plain;charset=utf-8")
          );
  
          final String err = ResponseUtils.attemptToReadErrorResponse(resp).toBlocking().first();
          assertThat(err).isEqualTo("");
      }
test_case.class_method_signature: ResponseUtilsTest.attemptToReadErrorResponse_noContentLength()
test_case.full_signature: @Test public void attemptToReadErrorResponse_noContentLength()
test_case.identifier: attemptToReadErrorResponse_noContentLength
test_case.invocations: getBytes response copiedBuffer add first toBlocking attemptToReadErrorResponse isEqualTo assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void attemptToReadErrorResponse_noContentLength()
focal_class.file: mesos-rxjava-client/src/main/java/com/mesosphere/mesos/rx/java/ResponseUtils.java
focal_class.identifier: ResponseUtils
focal_class.class_method_signature: ResponseUtils.ResponseUtils()
focal_class.full_signature: private  ResponseUtils()
focal_class.identifier: ResponseUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ResponseUtils()
focal_class.class_method_signature: ResponseUtils.attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)
focal_class.full_signature: @NotNull static Observable<String> attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)
focal_class.identifier: attemptToReadErrorResponse
focal_class.modifiers: @NotNull static
focal_class.parameters: (@NotNull final HttpClientResponse<ByteBuf> resp)
focal_class.return: Observable<String>
focal_class.signature: Observable<String> attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)
focal_class.class_method_signature: ResponseUtils.getErrMsg(final String contentType)
focal_class.full_signature: private static String getErrMsg(final String contentType)
focal_class.identifier: getErrMsg
focal_class.modifiers: private static
focal_class.parameters: (final String contentType)
focal_class.return: String
focal_class.signature: String getErrMsg(final String contentType)
focal_method.body: @NotNull
      static Observable<String> attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp) {
          final HttpResponseHeaders headers = resp.getHeaders();
          final String contentType = resp.getHeaders().get(HttpHeaderNames.CONTENT_TYPE);
          if (headers.isContentLengthSet() && headers.getContentLength() > 0 ) {
              if (contentType != null && contentType.startsWith("text/plain")) {
                  return resp.getContent()
                      .map(r -> r.toString(StandardCharsets.UTF_8));
              } else {
                  resp.ignoreContent();
                  final String errMsg = getErrMsg(contentType);
                  return Observable.just(errMsg);
              }
          } else {
              return Observable.just("");
          }
      }
focal_method.class_method_signature: ResponseUtils.attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)
focal_method.full_signature: @NotNull static Observable<String> attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)
focal_method.identifier: attemptToReadErrorResponse
focal_method.invocations: getHeaders get getHeaders isContentLengthSet getContentLength startsWith map getContent toString ignoreContent getErrMsg just just
focal_method.modifiers: @NotNull static
focal_method.parameters: (@NotNull final HttpClientResponse<ByteBuf> resp)
focal_method.return: Observable<String>
focal_method.signature: Observable<String> attemptToReadErrorResponse(@NotNull final HttpClientResponse<ByteBuf> resp)