这是我的请求xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Request>
<user>
<title>Mr</title>
<firstname>automation</firstname>
<lastname>Qa</lastname>
<department>Automation</department>
<mobile>999000777</mobile>
</user>
</Request>
这是我的实际休息保证代码:
String APIUrl = "http://autoTest.com/api/1/user/create";
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("title", "Mr");
hashMap.put("firstname", "automation");
hashMap.put("lastname", "testing");
hashMap.put("department", "test");
hashMap.put("mobile", "7878787");
Response response = RestAssured.given().auth().preemptive() .basic("userName", "passw0rd").
parameters(hashMap).when().post(APIUrl);
当我这样做时,它会让我在控制台中出现以下错误:
Bad request ,
Request resource or xml is not valid ,
Sorry, we could not find appropriate method or xml.
任何人都可以帮我找到我做错的事吗?
答案 0 :(得分:0)
您可能需要添加contentType("application/xml")
,以便确信它应该将地图序列化为XML。