0

I'm using Spring REST Docs (2.0.3.RELEASE) and Spring Auto Restdocs (2.0.6) to document a REST API.

When the request contains a query parameter that has no assigned value (empty string) the snippets produced by CliDocumentation.curlRequest() and HttpDocumentation.httpRequest() show the parameter duplicated. For example:

$ curl 'http://localhost:7001/my.app/books?code=&code=' -i -X

This happens whether I do

this.mockMvc.perform(
    get("/my.app/books?code=")
    ...

or

this.mockMvc.perform(
    get("/my.app/books").param("code", "")
    ...

This is similar to issue and duplicate, however this only happens for valueless parameters and the bug mentioned there was fixed in version 1.1.2.RELEASE of Spring REST Docs.

Note: I assume the issue is not with Spring Auto Restdocs since these are standard Spring REST Docs snippets.

Am I missing something?

  • This is a bug in Spring REST Docs. Could you please [open an issue](https://github.com/spring-projects/spring-restdocs/issues/new) so that we can fix it? – Andy Wilkinson Oct 03 '19 at 17:18
  • 1
    Thank you @AndyWilkinson . I have opened issue [#647](https://github.com/spring-projects/spring-restdocs/issues/647). – Bruno Silva Oct 04 '19 at 13:38

1 Answers1

1

As mentioned in the comments, this was a minor bug in Spring REST Docs that has been promptly fixed by @AndyWilkinson in this commit, to be released in version 2.0.5.RELEASE. Many thanks to @AndyWilkinson!