trafficcontrol icon indicating copy to clipboard operation
trafficcontrol copied to clipboard

profileparameters POST request with no request body returns Internal Server Error

Open ericholguin opened this issue 5 years ago • 3 comments

I'm submitting a ...

  • [X] bug report
  • [ ] new feature / enhancement request
  • [ ] improvement request (usability, performance, tech debt, etc.)
  • [ ] other

Traffic Control components affected ...

  • [ ] CDN in a Box
  • [ ] Documentation
  • [ ] Grove
  • [ ] Traffic Control Client
  • [ ] Traffic Monitor
  • [X] Traffic Ops
  • [ ] Traffic Ops ORT
  • [ ] Traffic Portal
  • [ ] Traffic Router
  • [ ] Traffic Stats
  • [ ] Traffic Vault
  • [ ] unknown

Current behavior:

Making a POST request to /profileparameters with no body in the request returns:

HTTP/1.1 500 Internal Server Error
{
    "alerts": [
        {
            "text": "Internal Server Error",
            "level": "error"
        }
    ]
}

Expected / new behavior:

Most endpoints return:

HTTP/1.1 400 Bad Request 
{
    "alerts": [
        {
            "text": "EOF",
            "level": "error"
        }
    ]
}

Minimal reproduction of the problem with instructions:

Anything else:

ericholguin avatar Feb 21 '20 18:02 ericholguin

Is that a regression, or did Perl panic too?

ocket8888 avatar Feb 21 '20 18:02 ocket8888

Perl returned:

HTTP/1.1 400 Bad Request
{
    "alerts": [
        {
            "level": "error",
            "text": "parameters must be in JSON format."
        }
    ]
}

ericholguin avatar Feb 21 '20 18:02 ericholguin

This is also caused syntactically invalid bodies e.g. [, {, and any valid JSON that isn't an object or array e.g. "string", null

ocket8888 avatar Jul 07 '22 16:07 ocket8888