POSTing Raw XML doesn't send the correct content-type
When attempting to POST to an XML endpoint, sending the XML as the raw request body, it seems that the XML body gets sent, if no content-type is explicitly set. But if the content-type is set properly, the call doesn't send the request body.
With a missing content-type, the server endpoint often cannot parse the request body correctly.
This ALSO happens using the swagger-editor. Is it my definition that is incorrect?
- swagger-ui version: 2.1.4
- a swagger file reproducing the issue:
swagger: "2.0"
info:
version: "0.0.1"
description:
Test case for POSTing XML
title: Test
host: localhost:3000
basePath: /
schemes:
- http
consumes:
- application/xml
produces:
- application/xml
paths:
/postxml:
post:
description: Test posting raw XML
consumes:
- application/xml
parameters:
- in: body
name: request
schema:
type: string
responses:
"200":
description: Success
schema:
type: string
default:
description: Error message
schema:
type: string
Can you please share what you see in the network console? Technically, your schema for the body parameter should be type: object since you're sending an XML object (I'm assuming).
i'm having the same issue, swagger don't support try operation using XML?
POSTing XML works fine - take a look at the pet store. The problem is probably with the definition of the request itself as a string.