swagger-api / swagger-api/swagger-ui

'Accept' header parameter not send correctly in request from UI

Open
#8,396 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Dear Dev-Team,

I try to create an web api endpoint that returns an image in a format that can be defined in the 'Accept-Header' field of the request. I'm using Swashbuckle NugGet Package (Swashbuckle.AspNetCore, Version 6.5.0) and the UI shows the parameter correctly: see
Swashbuckle Header Issue
As you can see there too, the curl parameter -H 'accept: text/plain' is wrong and should be 'image/jpeg'.

The openAPI definition is specified with an IOperationFilter that removes Action parameter of a certain type and inserts the Header parameter instead (see code below).
EaImageFormatFilter.cs (as *.txt)

Or am I doing something wrong?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Swagger UI request shown in the issue with the OpenAPI definition and the linked EaImageFormatFilter.txt example. Reproduce the generated curl command for the image endpoint and determine whether the incorrect Accept value comes from the definition or Swagger UI; done means the request uses the declared image media type.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.