Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #728
Closed
Open
Issue created Aug 03, 2018 by Administrator@rootContributor

Use Quality values in "Accept" request header

Created by: ackintosh

Description

Related issue: https://github.com/OpenAPITools/openapi-generator/issues/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

https://github.com/OpenAPITools/openapi-generator/issues/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.

Assignee
Assign to
Time tracking