Swagger Compliance Assertion: Invalid content type [image/bmp]
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Swagger Compliance Assertion: Invalid content type [image/bmp]
Hi there,
I wonder why I get the error mentioned in the topic. The image is properly transfered and displayed. Also I think image/bmp as a content type should be allowed.
Any suggestion what could go wrong here?
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Assertions
-
Function Tests
-
REST
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to check your API definition to see if it allows image/bmp content type in the response.
See https://swagger.io/docs/specification/describing-responses/ for more information.
https://apimate.eu
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @KarelHusa,
thanks for the suggestions. I forgot to say it because it became so self-evident for me to have a proper OpenApi.yaml.
image/bmp is the defined content-type in the swagger UI so the compliance assertion actually should get it right. Maybe you see something in our definition that I don't see:
@LennSar wrote:Hi there,
I wonder why I get the error mentioned in the topic. The image is properly transfered and displayed. Also I think image/bmp as a content type should be allowed.
Any suggestion what could go wrong here?
Thanks in advance!
/screenshot.bmp:
get:
servers:
- url: http://{Hostname}
description: http direct
variables:
Hostname:
default: 169.254.2.0
description: Hostname of the device
- url: https://{Hostname}
description: https direct
variables:
Hostname:
default: 169.254.2.0
description: Hostname of the device
- url: http://{Hostname}/{ID}
description: http forward
variables:
Hostname:
default: 169.254.2.0
description: Hostname of the device
ID:
default: "1"
description: System ID of the device
enum:
- "1"
- "2"
- "3"
- "4"
- url: https://{Hostname}/{ID}
description: https forward
variables:
Hostname:
default: 169.254.2.0
description: Hostname of the device
ID:
default: "1"
description: System ID of the device
enum:
- "1"
- "2"
- "3"
- "4"
summary: Get a screenshot
operationId: GET_screenshot.bmp
responses:
"200":
description: Screenshot in BMP format
content:
image/bmp:
schema:
type: string
format: binary
"405":
description: Method not allowed. Rights missing?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the API specification permits the content type and the response matches, it seems like a bug in the ReadyAPI assertion evaluation.
https://apimate.eu
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's what I suspect
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I have come across this as well. I think it's a known bug at ReadyAPI, but which they did not address yet. I disable the assertions for such a case.
Also detailed in this post: https://community.smartbear.com/t5/ReadyAPI-Questions/Swagger-compliance-assertion-with-content-type...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks @JoostDG for letting me know. I think I've seen that post before which is why I assumed it is a bug. I was just hoping it's not since the issue seems to be known for quite a while.
