Skip to content

bug: POST /api/v1/quote returns plain text error for empty JSON body #4439

@ChainsQueen

Description

@ChainsQueen

Problem

Sending an empty JSON body {} to the quote endpoint returns
a plain text error message instead of structured JSON.

Actual response:
Status: 422 Unprocessable Entity (WebDAV) (RFC 4918)
Content-Type: text/plain; charset=utf-8
Body: Failed to deserialize the JSON body into the target
type: missing field from at line 1 column 2

Impact

Low — does not block core functionality but causes SDK
clients and integrators to fail when parsing error responses
as they expect JSON on all responses from this endpoint.

To reproduce

  1. Send POST request to https://api.cow.fi/sepolia/api/v1/quote
  2. Set header: Content-Type: application/json
  3. Set body: {}
  4. Observe plain text 422 response instead of structured JSON

Expected behaviour

Status: 422
Content-Type: application/json
Body:
{
"errorType": "...",
"description": "..."
}

Screenshots/logs

See attached Postman screenshot showing the plain text
422 response for empty body request.
Image

Image Image Image

services version/commit hash and environment

Version: v2.362.3-dirty
Environment: production (https://api.cow.fi/sepolia)

Additional context

The plain text response appears to be Axum's default
JsonRejection behaviour which is not overridden here.
Reference: https://docs.rs/axum/latest/axum/extract/index.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtrack:maintenancemaintenance track

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions