-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
RequestSpecification.queryParam does not respect null values #1751
Comments
Not sure what @maxfd3v expects to happen, but I for one would like it if the query param was simply skipped when the passed value is null. I realise that it’s possible to wrap adding the query param in an if with a null check, but it looks verbose, especially when used in a parametrized junit 5 test: compare RequestSpecification req = RestAssured.given();
if (foo != null) {
req.queryParam("foo", foo);
}
if (bar != null) {
req.queryParam("bar", bar);
}
Response res = req.get(); to RequestSpecification req = RestAssured.given()
.queryParam("foo", foo)
.queryParam("bar", bar);
Response res = req.get(); I feel like it would be easy to draft a PR for this, but the problem is that it would be breaking, unless we add a new method, like |
rest-assured#1751 If this QueryParam value is null, no query parameter is added If not null, the query parameter is added with the given parameter name and value.
I opened a PR (#1776) to implement the functionality described in that part. |
|
RequestSpecification.queryParam ("myParam", null)
Will be passed to the target API as a "" (Blank String)
One has to test the incoming parameter and skip adding a queryParam to make it work
The text was updated successfully, but these errors were encountered: