ocket8888 opened a new issue #5510:
URL: https://github.com/apache/trafficcontrol/issues/5510
## I'm submitting a ...
- bug report
## Traffic Control components affected ...
- Traffic Ops
- Traffic Ops Client (Go)
## Current behavior:
The documentation mentions a query parameter, `param`, which is the ID of a
Parameter, and it fetches all Profiles to which the thereby identified
Parameter is assigned. This Parameter's type is unverified by the API (no
`Checker` specified in the `WhereColumnInfo`), and if you use it with an
unsupported value:
```http
GET /api/2.0/profiles?param=test HTTP/1.1
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=...
```
it causes an Internal Server Error:
```http
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type,
Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=...
Vary: Accept-Encoding/zUm3oa0elunc5VHcism6Qg==
X-Server-Name: traffic_ops_golang/
Date: Wed, 10 Feb 2021 18:56:29 GMT
Content-Length: 83
{
"alerts": [
{
"text": "Internal Server Error",
"level": "error"
}
]
}
```
What's strange is that the client also has methods that utilize this
Parameter and request input as a _string_, not an integral type, and there are
tests that are passing that use those methods.
The `Profile` structure in `lib/go-tc` has a `Parameter` field and the tests
appear to be using this field to provide the input for the query parameter. I
can only assume that the tests are passing merely by virtue of the request
returning a `200 OK` response, and that `Profile.Parameter` property is always
an empty string because it has no purpose or meaning and is never populated.
## Expected behavior:
The client should test that query parameters behave in their intended way,
data structures should not have fields that serve no purpose (requires
`ProfileV4`?), and passing a bad query parameter should result not in a `500
Internal Server Error` response, but a `400 Bad Request` response with an Alert
that explains why the request failed.
## Minimal reproduction of the problem with instructions:
Make the request as shown above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]