swagger-ui: Content-type is not being sent with GET and DELETE requests
* swagger-ui version* 2.2.3
Swagger file:
"/v1/processes/{guid}" : { "get" : { "tags" : [ "Process API" ], "summary" : "Finds an active process task with supplied process id", "description" : "The process id is an user defined unique identifier for New Business process instance", "operationId" : "findById", "schemes" : [ "https" ], "consumes" : [ "application/vnd.bpm-services.v1+json" ], "produces" : [ "application/json" ], "parameters" : [ { "name" : "guid", "in" : "path", "description" : "Process id", "required" : true, "type" : "string" } ], "responses" : { "200" : { "description" : "Successful: Process found with supplied process id", "schema" : { "$ref" : "#/definitions/BPMProcessDetail" } }, "401" : { "description" : "Operation failed: (Un Authenticated) Credentials supplied are not valid", "schema" : { "$ref" : "#/definitions/Response" } }, "403" : { "description" : "Operation failed: (Un Authorized) Principle corresponding to the supplied credentials is not allowed to access the operation", "schema" : { "$ref" : "#/definitions/Response" } }, "404" : { "description" : "Not Found: No active process instance found for supplied id", "schema" : { "$ref" : "#/definitions/Response" } }, "405" : { "description" : "Operation failed: (Method Not Allowed) Only allowed http method for this operation is GET", "schema" : { "$ref" : "#/definitions/Response" } }, "415" : { "description" : "Operation failed: (Unsupported Media Type) The only supported media type for operation is - application/vnd.bpm-services.v1+json", "schema" : { "$ref" : "#/definitions/Response" } }, "500" : { "description" : "Operation failed: (Internal Server Error) An unexpected error was encountered, please check the logs for detailed message", "schema" : { "$ref" : "#/definitions/Response" } } } }
Curl request from swagger-ui
curl -X GET --header 'Accept: application/json' 'http://localhost:9080/bpm-services/rest/v1/processes/232'
as the api methods needs the specific content type, the call failes with 415
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (5 by maintainers)
Since version 3.0.0 of the spec is explicitly not allowing payloads for GET and DELETE operations, it doesn’t make sense to fix this.
@DavidBiesack well it’s not about response content-type, that should only match with accept header. But I am talking about the request content-type which should be matched with @Consume annotation on resource method and this just specifies only one type. So ideally it should by default be sent with request as separate header (Content-Type) but swagger-ui is just ignoring it