-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/query parameters #39
Feature/query parameters #39
Conversation
b634fd2
to
78723fd
Compare
}; | ||
} | ||
|
||
public static RequestMatcher hasQueryParameters(final SimpleEntry<String, String>... expectedParams) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd preffer here a dedidacted QueryParam
class instead of SimpleEntry
as so the users won't have problems as of what the parameter is all about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can add that.
Similar to #40, I don't seem to be able to reproduce the lint errors locally. I can fix them, but I just need to know what's causing them (I can't see the report(s), either on CircleCI). |
78723fd
to
43d48a8
Compare
As requested, I added a class called |
final int idx = pair.indexOf("="); | ||
final String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair; | ||
if (!query_pairs.containsKey(key)) { | ||
query_pairs.put(key, new LinkedList<String>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better to create the list, populate it with items and them put it in a map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll modify this.
3b8e4d0
to
9b0457f
Compare
@andrzejchm I think I addressed your comments in the latest commits. |
Hm, so CircleCI seems to think something is wrong wrt to the FindBugs configuration, but the findbugs.html report in the artifacts doesn't seem to show anything. |
Ah. Nevermind. I found the problem. It was complaining about my use of |
@andrzejchm review ping? |
* A key/value set representing query parameters in an HTTP request. | ||
*/ | ||
public class QueryParam { | ||
private String key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be final then
Also: - Remove unused imports and template block comment that was causing static analysis warnings.
Also: - Add a test for query parameter splitting logic.
7f432c3
to
fedc66c
Compare
Also: - Made a small adjustment to the RESTMockServer logger to make it public. I also make it, by default, a NoOpLogger, and initialized it immediately, rather than initializing it during the constructor (so it will never be null).
@andrzejchm Added the logging, as requested. Also I modified |
Adds two methods:
hasQueryParameters()
andhasQueryParameters(AbstractMap.SimpleEntry<String, String> params...)
. The latter version checks whether the request has exactly the query parameters specified, whereas the former checks whether there are any parameters given at all.