swangkkb / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

put parameters ignored #251

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
JUNIT test:
expect().statusCode(Status.NO_CONTENT.getStatusCode())
        .given()
        .parameters("name", name, "URL", URL)
        .cookie(cookie_name, newapi_session_id)
        .put("/IfdOrganization/"+orgGuid);

Server code:
@PUT @Path("/{guid}") @Produces({APPLICATION_XML, APPLICATION_JSON})
public void update(@PathParam("guid") String guid, @FormParam("name") String 
name,@FormParam("URL") String URL,@CookieParam(session_cookie_name) String 
sessionId, @Context HttpHeaders headers) {
}

What is the expected output? What do you see instead?
"@FormParam("name") String name" and "@FormParam("URL") String URL" should have 
a value. When using put they are null

What version of the product are you using? On what operating system?
eclipse kepler, windows 8, rest-assured-1.8.0

Please provide any additional information below.

When doing a PUT in my JUnit test the parameters "name" and "URL"' value are 
null on the server. If I change ".put()" to ".post()" on the JUnit test and 
change "@PUT" to "@POST" on the server the parameters' value is correct. Also, 
when using PUT in AJAX the parameters gets the correct value. 

Any help appreciated

Original issue reported on code.google.com by jon.ande...@catenda.no on 22 Jul 2013 at 2:37

GoogleCodeExporter commented 9 years ago
Same problem with rest-assured-1.8.1

Original comment by jon.ande...@catenda.no on 22 Jul 2013 at 2:46

GoogleCodeExporter commented 9 years ago
That's because the default parameter types for PUT is request parameters and 
not form parameters. Change "parameters(..)" to "formParameters(..)" and it'll 
probably work.

Original comment by johan.ha...@gmail.com on 6 Aug 2013 at 7:32