How to remove Accept Header from HttpRequestBuilder


def putXXX(): ChainBuilder =
  feed(xxxxxxIdFeeder)
    .exec(
      http("xxx xxx for xxx")
        .put("/"+"${xxx}")
        .header(HeaderConstants.X_API_KEY, CLIENT_ID)
        .header(HeaderConstants.X_REQUEST_ID, LoadTestConfiguration.requestIdPrefix + "${randomString}")
        .header(HttpHeaderNames.Authorization, session =>
          "Bearer " + Auth.getClientData(session).token
        )
        .body(RawFileBody("abc.json")).asJSON
        .check(status.is(StatusCode.OK))
    )

The above code generates Http Request where Accept header is being sent as application/json.

Is there a way to remove this header explicitly? Actually in case of Accept header, server is returning 406.

You’re the one adding the Content-Type header with asJSON. If you don’t want the Content-Type header, just don’t add it :slight_smile: