title: java REST Assured response body with Content-Type: text/html with injected html tags
body: <p>Let's say someone developed rest api that returns data in json format but he didn't set response <code>Content-Type</code> to <code>application/json</code> but <code>text/html</code>.</p>
  
  <p>Now I have test written in REST Assured:</p>
  
  <pre><code>    given()
      .param("username", username)
      .param("password", password)
  .when()
      .get("/authenticate")
  .then()
      .statusCode(200)
      .body("user.id" , hasItem(20));
  </code></pre>
  
  <p>but it doesn't work. I logged out response body and and that's what I get: </p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;{"key":"752E7A74E8F3999BE9EFE3EA0E0DF320","user":{"id":20,"firstName":"K1","lastName":"K1","role":"ROLE_CUSTOMER","phoneNumber":"888888888"},"expirationDate":"2016-08-10T13:52:50+02:00"}&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the error:</p>
  
  <pre><code>FAILED: test_login_as_valid_customer("888888888", "3432")
  java.lang.AssertionError: 1 expectation failed.
  JSON path key doesn't match.
  Expected: 20
    Actual:
  </code></pre>
  
  <p>Between body tags there is my expected json but where did html tags come from? I cant't see them in response when I test api method in Postman or Paw or even in web browser (since it is simple GET with url params).</p>
  
  <p>I suspect I get error "JSON path key doesn't match." because of those tags.</p>