나는 Rest Assured를 사용하여 REST API를 테스트하고 있습니다. url과 body 내용의 매개 변수를 모두 사용하여 POST를 시도 할 때 오류가 발생합니다. 이것은 수동으로 테스트 할 때 올바르게 작동합니다. 매개 변수가 URL을 형성 제거Rest Assured - 매개 변수 및 본문으로 POST 할 수 없습니다.
테스트 코드 옵션을 선택하지 않습니다 :
String endpoint = http://localhost:8080/x/y/z/id?custom=test;
String body = "[{\"boolField\":true,\"intField\":991},
{\"boolField\":false,\"intField\":998}]";
expect().spec(OK).given().body(body).post(endpoint);
나머지는 허용하지 피보험자 않는 이유
You can either send parameters OR body content in the POST, not both!
java.lang.IllegalStateException: You can either send parameters OR body content in the POST, not both!
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:198)
at com.jayway.restassured.internal.RequestSpecificationImpl.sendRequest(RequestSpecificationImpl.groovy:282)
at com.jayway.restassured.internal.RequestSpecificationImpl.this$2$sendRequest(RequestSpecificationImpl.groovy)
at com.jayway.restassured.internal.RequestSpecificationImpl$this$2$sendRequest.callCurrent(Unknown Source)
at com.jayway.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy:83)
...
을 실행할 때 다음과 같은 오류가 발생 두 매개 변수 및 본문 내용에 게시물?
임 사용하여 나머지 오히려 오래된 인 1.1.6을 피보험자 다음은 예입니다. 그러나 [github] (https://github.com/jayway/rest-assured/blob/master/rest-assured/src/main/groovy/com/jayway/restassured/internal/RequestSpecificationImpl.groovy)의 코드를 보면) 이것은 여전히 문제로 보입니다. –
Post 매개 변수와 본문을 가질 수 있다는 것을 몰랐기 때문에 Rest Assured의 작성자도 마찬가지 였을 것입니다. 너 자신을 안심 시켜라.이 수표를 주석 처리 해 봤니? – mercutio
님이 rest-assured 관련 문제를 생성했습니다. http://code.google.com/p/rest-assured/issues/detail?id=196&thanks=196&ts=1346105863 –