ocket8888 opened a new issue #5503: URL: https://github.com/apache/trafficcontrol/issues/5503
## I'm submitting a ... - improvement request (usability, performance, tech debt, etc.) ## Traffic Control components affected ... - Traffic Ops Client (Go) ## Current behavior: When the Traffic Ops API response to a request made by the Go client is >= 300 and != 304, the body of the response is read into the content of a returned error - and behind the scenes the body is also closed. This makes it difficult to write client methods that actually return error alerts, since the normally used methods employed by writers of a new client method will all exhibit this behavior. It's not that it's impossible, it's just not possible using the common `RawRequest`, `makeRequestWithHdr`, `post`/`put`/`get`/etc. methods. ## New behavior: The client should return an error like "Traffic Ops responded with 400 Bad Request" and leave the alerts to the actual returned Alerts. I'm not sure if this can actually be done in the APIv3- client(s), since the tests check for alert text in the errors, which might mean that it's expected behavior on which clients depend. But it can safely be done in the new APIv4 client, since nobody's using that. ## Minimal reproduction of the problem with instructions: Use a client method that results in an error, notice that no alerts are returned. ---------------------------------------------------------------- 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]
