Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
You can try Swagger UI 3.0 – HEAD has "try it out" by default in this version.
If you use Swagger UI 2.0, HEAD is disabled by default. You need to explicitly enable it in the
supportedSubmitMethods
list in the Swagger UI initialization code in index.html:
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch', 'head'],
// ^
// ------------------------------------------------------------------┘
By the way, schema
in a HEAD response is not really useful because HEAD is not supposed to return an actual body – only the headers. You should change the 200 response to:
responses:
description: success response
to add up, in java you can add a bean in your swagger config class to do that:
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
UiConfiguration uiConfig() {
return new UiConfiguration(null, UiConfiguration.Constants.NO_SUBMIT_METHODS);
Basically it will put supportedSubmitMethods
to []
.
@Bean
UiConfiguration uiConfiguration() {
return new UiConfiguration( null, new String[] {"get", "post", "put", "delete", "patch", "head"} );
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.