We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Spring Cloud Contract does not generate correct test classes for Form URL encoded request body
Version: 4.0.4
4.0.4
request: method: POST url: /exportData body: "fromDt=16-Aug-2023&toDt=25-Aug-2023" headers: Content-Type: "application/x-www-form-urlencoded; charset=UTF-8" response: status: 200 bodyFromFileAsBytes: response/export_data.xlsx headers: Content-Disposition: "attachment; filename=[EXTRACT] Export Data.xlsx"
@Test public void validate_export_data() throws Exception { // given: MockMvcRequestSpecification request = given() .header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") .body(""); // when: ResponseOptions response = given().spec(request) .post("/exportData"); // then: assertThat(response.statusCode()).isEqualTo(200); assertThat(response.header("Content-Disposition")).isEqualTo("attachment; filename=[EXTRACT] Export Data.xlsx"); // and: assertThat(response.getBody().asByteArray()).isEqualTo(fileToBytes(this, "export_data_response_export_data.xlsx")); }
The body of request is generated as empty string in Test Class instead of the configured body in yaml
The behavior is same even if contract is configured in groovy as follows:
org.springframework.cloud.contract.spec.Contract.make { request { method 'POST' url '/exportData' headers { header("Content-Type": 'application/x-www-form-urlencoded; charset=UTF-8') } body('fromDt=16-Aug-2023&toDt=25-Aug-2023') } response { status 200 } }
The text was updated successfully, but these errors were encountered:
fixed through 7975d43
Sorry, something went wrong.
Fixed missing support for String body for URL encoded request; fixes g…
7975d43
…h-1931
@marcingrzejszczak: Do we know by when this fix will be GA? I checked the milestone page and it does not list a release date.
We haven't yet picked the date. You can check this page https://github.com/spring-cloud/spring-cloud-release/milestones and once we agree on a release date the page will get updated
No branches or pull requests
Spring Cloud Contract does not generate correct test classes for Form URL encoded request body
Version:
4.0.4
Contract
Generated Test Case
The body of request is generated as empty string in Test Class instead of the configured body in yaml
The behavior is same even if contract is configured in groovy as follows:
The text was updated successfully, but these errors were encountered: