Skip to content

[Bug] API accepts non-JSON content-type causing parsing errors #755

Description

@Dev-AdeTutu

Describe the Bug

API endpoints don't validate Content-Type header. Accepting form-data or plain text as JSON causes confusing parser errors.

Steps to Reproduce

  1. POST to /api/payments with Content-Type: text/plain
  2. Send JSON body
  3. Get 500 error: "Unexpected token in JSON"
  4. No clear indication of Content-Type mismatch

Expected Behavior

Validate Content-Type header, return 415 Unsupported Media Type with clear message.

Actual Behavior

Cryptic JSON parsing errors.

Environment

Field Value
Component backend / api
OS Ubuntu 22.04
Network testnet

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programapiREST API contract, schema, or documentationbackendbugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions