Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Quality values in "Accept" request header #728

Open
ackintosh opened this issue Aug 3, 2018 · 0 comments
Open

Use Quality values in "Accept" request header #728

ackintosh opened this issue Aug 3, 2018 · 0 comments

Comments

@ackintosh
Copy link
Contributor

ackintosh commented Aug 3, 2018

Description

Related issue: #440

In the case below:

openapi: 3.0.0

servers:
- url: http://localhost/myapi

info:
  version: "1.0"
  title: My API

security:
- basicAuth: []

paths:

  /download:
    get:
      operationId: download
      responses:
        200:
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        500:
          description: Error
          content:
            application/json:
              schema:
                type: string

the generated api client (e.g. python client) selects application/json as Accept header. but the API server accepts application/octet-stream. (the API server returns application/json only in case of 500 error.)
So the request from the API client is always result as 406 Not accepted.

openapi-generator version

latest master

Related issues/PRs

#440

Suggest a fix/enhancement

Use Quality values in "Accept" request header instead of removing all media types except application/json.

Accept: application/json,application/octet-stream;q=0.9
  • list all media types defined in a spec
  • application/json is set always default value ( 1 )
  • other media types is set q=0.9

This suggestion keeps the priority that api client needs and avoid the error described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant