我正在尝试在请求正文中点击一个需要低于XML命名空间的REST api。
<candidate name="xyz" ldap-alias="abc" ldap-dn="abcd">
<secondary-ref ldap-alias="klm" ldap-dn="abcd"/>
</candidate>
我的要求是:
expect().contentType("application/json").expect().statusCode(200).log().all().when().request().contentType("application/json").post("myrequest");
任何人都可以帮忙吗?
谢谢兰吉特
XML太小了,我可能只是将XML粘贴到一个字符串中,并将其传递给放心的正文:
String xml = "<candidate name="xyz" ldap-alias="abc" ldap-dn="abcd">n<secondary-ref ldap-alias="klm" ldap-dn="abcd"/>n</candidate>";
given().
contentType(ContentType.XML).
body(xml).
when().
post("myrequest").
then().
statusCode(200).
contentType(ContentType.JSON);