-
Notifications
You must be signed in to change notification settings - Fork 238
Description
What happened?
Background:
If formParams are given to Rest-Assured as formParam(key, value), then the value is not allowed to be null. In case of null, an exception is thrown by Rest-Assured.
If formParams are given to Rest-Assured as formParas(groovy map), then the map is allowed to contain key-value pairs with value=null - Rest-Assured doesn't complain and performs the request by filtering out the params with null value.
Issue:
Giving Rest-Assured fromParams via a map containing null value it results in exception from Allure:
java.lang.ClassCastException: class io.restassured.internal.NoParameterValue cannot be cast to class java.lang.String (io.restassured.internal.NoParameterValue is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
Example code:
import spock.lang.Specification
import static io.restassured.RestAssured.given
import static io.restassured.http.Method.POST
class DummySpec extends Specification {
def "Rest-Assured issue"() {
given:
Map formParams = [
"param1": "value1",
"param2": null]
expect:
given()
.formParams(formParams)
.baseUri("http://127.0.0.1")
.when().request(POST)
.then().extract().response()
}
}
Since issue starts from version 2.26.0, it's probably related to #1016
What Allure Integration are you using?
allure-rest-assured, allure-spock2
What version of Allure Integration you are using?
2.29.0
What version of Allure Report you are using?
2.34.1
Code of Conduct
- I agree to follow this project's Code of Conduct