Rest-Assured - Query string is duplicated in generated snippets
See original GitHub issueThere seems to be a problem with curl- and http-snippet generation. The request params are doubled:
$ curl 'http://loclhost/tags/list?page=0&per_page=3?page=0&per_page=3' -i -H 'Accept: application/json'
GET /tags/list?page=0&per_page=3&page=0&per_page=3 HTTP/1.1 Accept: application/json Host: localhost
I use Rest-Assured:
given(this.spec)
.accept("application/json")
.filter(document("tag-list",
preprocessRequest(prettyPrint(), modifyUris().scheme("http").host("loclhost").removePort()),
preprocessResponse(prettyPrint()),
requestParameters(
parameterWithName("page").description("Number of the page to retrieve").optional(),
parameterWithName("per_page").description("Entries per page").optional()
),
responseFields(
fieldWithPath("content").description("Array of elements"),
fieldWithPath("totalPages").description("Total number of pages"),
fieldWithPath("totalElements").description("Total number of elements"),
fieldWithPath("first").description("Is this the first page?"),
fieldWithPath("last").description("Is this the last page?"),
fieldWithPath("numberOfElements").description("Number of elements on this page"),
fieldWithPath("sort").description("Sort order").ignored(),
fieldWithPath("size").description("Number of elements on each page"),
fieldWithPath("number").description("Page number")
)))
.when()
.port(this.port)
.get("/tags/list?page=0&per_page=3")
.then()
.log().ifValidationFails()
.time(lessThan(2000L))
.assertThat().statusCode(200)
.and()
.assertThat().contentType("application/json")
Maybe, this is related to #286 ?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Spring REST Docs duplicates query parameter without value ...
When the request contains a query parameter that has no assigned value (empty string) the snippets produced by CliDocumentation.
Read more >Rest Assured - Avoid Duplicate code via RequestSpecification ...
In this video I've shown how to avoid duplicate code in Rest Assured using RequestSpecification and ResponseSpecification.
Read more >spring-projects/spring-restdocs - Gitter
This attribute is user configurable using the $page query parameter (see ... I'm generating my snippets with rest assured in the integration tests....
Read more >The best way to add a Request Body to a POST request using ...
It's in different ways and one is unanimous: the use of either String or HashMap in the requests. The intention here is to...
Read more >Spring Cloud Contract Reference Documentation
How Can I Debug the Mapping, Request, or Response Being Sent by WireMock? 8.10. ... How Can I Generate Spring REST Docs Snippets...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great. Btw, there’s no need for the exclude there. And if you’re using Spring Boot you could just override
spring-restdocs.version
instead.Thanks. Are you using Spring Boot? If so, its dependency management will be forcing the core module (which is where the fix is) to be 1.1.1.RELEASE. If not, please provide a complete example that reproduces the problem.