swagger-api / swagger-api/swagger-ui
content type of string/binary property should be octet-stream
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: Ubuntu
- Browser: Firefox 96.0.2
- Method of installation: docker container
- Swagger-UI version: 4.4.1
- Swagger/OpenAPI version: [OpenAPI 3.0]
Content & configuration
Example Swagger/OpenAPI definition:
put:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
myProperty:
type: string
format: binary
Describe the bug you're encountering
When sending the above request in swagger UI myProperty is getting the header Content-Type: text/plain but according to this
it should be application/octet-stream.
If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
Expected behavior
The content type for a string/binary property is application/octet-stream.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Swagger UI by reproducing the multipart/form-data request from the issue, using a requestBody property with type string and format binary. Trace how the myProperty part receives its header and verify that the completed behavior uses application/octet-stream instead of text/plain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100