Skip to content

[Bug] Signup endpoint returns JSON body with text/plain content-type header #634

@rohansx

Description

@rohansx

Bug

In app/modules/auth/auth_router.py, the POST /signup and POST /auth/custom-token endpoints use Response(content=json.dumps(...)) to return JSON data. The Response class defaults to Content-Type: text/plain, so clients that check the content-type header will not parse the body as JSON.

# Current (broken — Content-Type: text/plain):
return Response(content=json.dumps({"error": "Missing uid"}), status_code=400)

# Should be (Content-Type: application/json):
return JSONResponse(content={"error": "Missing uid"}, status_code=400)

18 instances across the signup handler and custom-token handler are affected. Meanwhile, other routes in the same file (login, SSO login, provider endpoints) correctly use JSONResponse.

Impact

  • API clients and frontend code that checks the Content-Type header will not parse signup/custom-token responses as JSON
  • Inconsistent response format within the same router — login returns application/json but signup returns text/plain for equivalent JSON bodies

Expected behavior

All endpoints returning JSON data should use JSONResponse (or set media_type="application/json") so the Content-Type header is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions