我想放心地将JSON文件加载到正文中,但出现错误415。
你能帮我吗?
代码是:
public class Entitlement_Creation extends BaseClass {
@Test
public void JsonPayload() throws IOException
{
Path json_data = Paths.get("test.json");
byte[] wikiArray = Files.readAllBytes(json_data);
String wikiString = new String(wikiArray);
System.out.println(wikiString);
given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
.body(wikiString)
.when()
.put()
.then()
.statusCode(200)
.extract()
.response();
}
答案 0 :(得分:0)
在此代码段中,我看不到有关您的服务网址的任何信息。 您应该将URL作为put()方法的参数。