Dip*_*man 3 api automation rest-assured
放心版本:3.0.5
作为用户,我们已将 contentType 作为 XML 以以下格式传递并具有有效内容。
contentType(ContentType.XML) OR .contentType("application/xml")
Run Code Online (Sandbox Code Playgroud)
在应用程序中允许的内容类型是:“application/xml” 提供的内容类型反映如下。
Content-Type=application/xml; charset=ISO-8859-1
Run Code Online (Sandbox Code Playgroud)
因此,它给出了错误“内容类型无效”如何处理此用例。
正如预期的内容类型是 application/xml 但提供的内容类型对象包括“charset=ISO-8859-1”。因此,我们需要删除此字符集详细信息。
EncoderConfig encoderconfig = new EncoderConfig();
Response response = given()
.config(RestAssured.config()
.encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.XML)
.log().all().body(this.buildPayload()).when().
post(...).
Run Code Online (Sandbox Code Playgroud)
...;
更多详情请参考以下链接:
https://groups.google.com/forum/#!topic/rest-assured/O74EgJWUSJY
归档时间: |
|
查看次数: |
3437 次 |
最近记录: |