https://github.com/jayway/rest-assured (バージョン 3.2.1) を使用して REST API をテストしていますが、Content-Type の設定に問題があります。
私は次のテストを行っています、
@Test
public void testSendContentType(){
String str = givenThat()
.when()
.contentType(ContentType.URLENC)
.get(URL).asString();
System.out.println(str);
}
テストを実行した後、次のヘッダーを設定しました。
キャプチャされたヘッダー
Expires: Mon, 30 Jun 2014 14:33:21 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json;charset=utf-8
コードをデバッグして調べましたが、コンテンツ タイプがどのように設定されているか、また提供しているコンテンツ タイプが設定されていない理由を理解できません。
私も以下を試しましたが、うまくいきませんでした
.header("Content-Type", ""application/x-www-form-urlencoded")