Skip to content

Elements does not include the Accept request header #1798

@Linuus

Description

@Linuus

Describe the bug

In OpenAPI the Accept request header is defined by responses.<code>.content.<media-type>. When making a request from the Elements app, it doesn't add this Accept header.

To Reproduce

Given this OpenAPI document:

---
openapi: 3.1.0
info:
  version: 1.0.0
  title: Test
servers:
- url: http://localhost:3000
  description: Development
paths:
  "/foobars":
    get:
      operationId: fetchFoobars
      summary: Fetch foobars
      tags:
      - Foobars
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  title: Foobar
                  properties:
                    id:
                      type: integer
                      description: The ID of the Foobar
                  required:
                  - id
                  additionalProperties: false

The Elements app is generating this request:

curl --request GET \
  --url http://localhost:3000/foobars \
  --header 'Content-Type: application/json'

Here we can see that the Content-Type header is set but not the Accept header.

Expected behavior

I expect the request to include the Accept header:

curl --request GET \
  --url http://localhost:3000/foobars \
  --header 'Content-Type: application/json'
  --header 'Accept: application/json'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions