Not able to decode multipart response
See original GitHub issueQ&A (please complete the following information)
- OS: Windows
- Browser: Chrome
- Version: 73.
- Method of installation: npm
- Swagger-UI version: Latest
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Fails to decode the response when it is of multipart type.
Example Swagger/OpenAPI definition:
# your YAML here
/xyz:
post:
parameters:
- in: query
name: q
required: true
schema:
type: string
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
upfile:
type: string
format: binary
params:
type: string
responses:
'200':
description: OK
content:
multipart/form-data:
schema:
type: object
properties:
points:
type: string
file:
type: string
format: binary
encoding:
points:
contentType: text/plain
file:
contentType: application/octet-stream
Describe the bug you’re encountering
When the UI receives the response from the server where the response has multipart body, the UI doesn’t decode the message and displays the result accordingly.
Currently it shows the following error and tries to display everything as text (even the binary junk characters) and the multipart data is not split into corresponding part files.
Response body Unrecognized response type; displaying content as text.
--29c81d996c8947829f47f91a3c36aa4f
Content-Disposition: form-data; name="points"
[1,2,3,4,5]
--29c81d996c8947829f47f91a3c36aa4f
Content-Disposition: form-data; name="file"; filename="tmp1e95kj4w.nii.gz"
Content-Type: application/octet-stream
��8�\�tmp1e95kj4w.nii��$��V��0?� 7������~��08u���JI))�ʔV�8���T�[Kս�̙�����G����Ͽ����������w�������������?����5����o�5�x������/O���_���?��ϟ���?}
Expected behavior
- binary data part as downloadable link
- text/plain data part on UI screen
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5
Top Results From Across the Web
How can I decode a multipart HTTP response? - Stack Overflow
I have an ASP.NET web application that's returning a multi-part response containing a JSON-encoded object, plus a bunch of binary files.
Read more >Working with Multipart — aiohttp 3.8.3 documentation
Assume you made a request, as usual, and want to process the response multipart data: async with aiohttp.request(...) as resp: pass.
Read more >Uploading and copying objects using multipart upload
Multipart upload allows you to upload a single object as a set of parts. Each part is a contiguous portion of the object's...
Read more >Parse multipart/form-data response in salesforce
this requirement seems to be a combination of both an inbuilt class AND some manual efforts from your end! The file needs to...
Read more >multipart/form-data fetch cannot be parsed with Response ...
One should be able to use the .formData on the result, and it should not be encoded in base64 - NOT sending the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Much needed feature as API client.
Hi! Happy to finally find people who have the same issue 😄 Any news concerning this issue? Any workaround that we can use to display a file alongside a textbox?