Skip to content

Remove unnecessary Content-Type header from GET /models request #9

@s2x

Description

@s2x

Description

In fetchModelsFromApi() (index.mjs:433-438), the Content-Type: application/json header is set on a GET request that has no body:

const res = await fetch(`${apiBaseURL}/models`, {
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",  // ← unnecessary for GET
  },
});

Per HTTP semantics (RFC 9110 §8.3), Content-Type describes the representation data in the message body. A GET request has no body, so this header is semantically incorrect.

Impact

  • Functionally harmless — most servers ignore Content-Type on GET requests.
  • Some strict API gateways or WAFs might log warnings or behave unexpectedly.
  • Misleading for developers reading the code — suggests the request sends a body.

Proposed fix

const res = await fetch(`${apiBaseURL}/models`, {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
});

If an Accept header is desired:

headers: {
  Authorization: `Bearer ${apiKey}`,
  Accept: "application/json",
},

Acceptance criteria

  • Content-Type header is removed from the GET /models request.
  • Optionally, Accept: application/json is added if the API benefits from explicit content negotiation.
  • Existing integration test "should fetch and sort models" passes with updated header expectations.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions