Closed GoogleCodeExporter closed 9 years ago
Thanks for reporting
Original comment by johan.ha...@gmail.com
on 8 May 2012 at 11:25
I've fixed this in trunk now. Please verify by depending on version
1.6.2-SNAPSHOT after having added the following repo:
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots />
</repository>
</repositories>
Original comment by johan.ha...@gmail.com
on 23 May 2012 at 12:36
Original comment by johan.ha...@gmail.com
on 23 May 2012 at 12:37
I just tried 1.6.2, unfortunately this bug still there. Changelog also
describes different use case.
Problem is with parameters which have same name but different values (e.g.
"param" below):
http://localhost/some/resource?param={val1}¶m={val2}¶m={val3}
Original comment by rus...@gmail.com
on 17 Jun 2012 at 7:01
Oh so I misunderstood what was going on. At least another bug was fixed. I'll
reopen the issue.
Original comment by johan.ha...@gmail.com
on 18 Jun 2012 at 5:40
Simple "me too" comment, yeah I know.
Because of this bug I have to write tests that relies on correct HTTP behavior
with plain HttpClient when all other tests are wrote using rest-assured, that's
not pretty :-)
Thanks for taking this bug report into account.
Original comment by eskato...@gmail.com
on 3 Sep 2013 at 12:01
Please help out with a pull request if can!
Original comment by johan.ha...@gmail.com
on 3 Sep 2013 at 12:32
I can give it a try.
Could you point me where in the code you think the culprit is?
Original comment by eskato...@gmail.com
on 3 Sep 2013 at 1:48
Hmm not quite sure, I tried to look in the code briefly but I couldn't find an
exact spot. Probably have to debug it in order to see what's causing it. I
don't have the time to do this atm though so if you want to help out that would
be really nice.
Original comment by johan.ha...@gmail.com
on 3 Sep 2013 at 2:18
I took another look at this issue and it appears that things are working OK
when using queryParam("key", "value1", value2" ) or when using
queryParam("key","value1").queryParam("key","value2") but NOT when using
get("/path/to/rsrc?key=value1&key=value2").
Original comment by eskato...@gmail.com
on 5 Sep 2013 at 2:09
I might be wrong (didn't debug it, just followed the code, plus I have 0
knowledge with Groovy, I use rest-assured with Java), but it seems the reason
may be in usage of Map to store parsed URL parameters in
extractRequestParamsIfNeeded function (RequestSpecificationImpl class):
---
private Map<String, Object> requestParameters
private Map<String, Object> queryParameters
<...>
private String extractRequestParamsIfNeeded(Method method, String path) {
if(path.contains("?")) {
<...>
def keyValueParams = allParamAsString.split("&");
keyValueParams.each {
<...>
} else {
theKey = keyValue[0]
theValue = keyValue[1]
}
if(method == POST) {
queryParameters.put(theKey, theValue)
} else {
requestParameters.put(theKey, theValue);
}
};
<...>
---
I guess Map in Groovy, as in Java will override the previous value of the
existing key, thus discarding multiple parameters with the same name, but with
different values.
The full chain of events:
in RequestSpecificationImpl: get(path) -> applyPathParamsAndSendRequest(path)
->
invokeFilterChain(path)
-> it has those lines:
filters << new RootFilter()
def ctx = new FilterContextImpl(..., filters);
ctx.next(this, responseSpecification)
-> last statement calls
in FilterContextImpl next(...), which calls:
def next = filters.next()
-> this refers to
in RootFilter: filter(FilterableRequestSpecification requestSpecification, ...)
requestSpecification.sendRequest
-> which refers back to RequestSpecificationImpl
private def Response sendRequest(path, method, assertionClosure) {
path = extractRequestParamsIfNeeded(method, path);
Note that this is a private function, that I couldn't find in the
FilterableRequestSpecification interface or interfaces it extends, so I'm not
even sure how it's called (I suppose private can be called still due to Groovy
issue described here: http://jira.codehaus.org/browse/GROOVY-1875), but there's
no other sendRequest function anywhere in the code, so it must be it.
->
finally that function calls in RequestSpecificationImpl
extractRequestParamsIfNeeded, which splits the path and puts all parameters in
the Map, as I specified at the top.
Original comment by kiril.st...@gmail.com
on 27 Oct 2013 at 7:22
I've now fixed this in master. Please try version 1.8.2-SNAPSHOT after having
added the following maven repo:
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots />
</repository>
</repositories>
Thanks for your investigation, it really helped me pinpoint the problem.
Original comment by johan.ha...@gmail.com
on 14 Nov 2013 at 9:48
Original issue reported on code.google.com by
rus...@gmail.com
on 3 May 2012 at 11:58