allure-java icon indicating copy to clipboard operation
allure-java copied to clipboard

🐞: allure-rest-assured not able to handle formParams containing null value

Open Sedemicra opened this issue 7 months ago • 0 comments

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 https://github.com/allure-framework/allure-java/pull/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

  • [x] I agree to follow this project's Code of Conduct

Sedemicra avatar Jul 04 '25 15:07 Sedemicra