spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 736 forks source link

cannot set base path parameter #326

Closed nkonev closed 8 years ago

nkonev commented 8 years ago

I started with example from here spring-swagger2markup-demo In swagger-ui I can see "base path" which is set by affect of Spring Boot server.contextPath config property: aaa/v3 swagger-ui

Obvously =), base path are presents in swagger's generated adocs: basepath-in-swagger

But it ignored by restdocs restdocs.

I found what I can set scheme, host and port as described here doc.

It would be great if it could be set up and the basepath (probably among withScheme(), withHost(), withPort()) in restdocs too.

wilkinsona commented 8 years ago

I'm not 100% sure that I've understood the problem, but if I have, the section of the documentation that you've linked to describes what you need to do:

To configure a request’s context path, use the contextPath method on MockHttpServletRequestBuilder.

Does that help?

nkonev commented 8 years ago

Yes, it's (MockHttpServletRequestBuilder#contextPath) solves the trouble, thanks!