Repository navigation
fix: name the HTTP status in upload, evaluate and Bitbucket errors - #1351
Conversation
Other packages report HTTP errors by bare code and are about to render them the same way as the API client does, so the helper needs to be reachable from them.
An upload refused by the storage bucket read "upload refused with HTTP 403". It now reads "HTTP 403 Forbidden", like the API client's errors.
A refused policy fetch and a server-side evaluation the API turned down were reported by bare code, e.g. "the Kosli server answered 403". They now read "HTTP 403 Forbidden", like the API client's errors.
A pull request or commit list that came back with a success other than 200 was reported as "got HTTP status 202". It now reads "got HTTP 202 Accepted", like the API client's errors. The fake Bitbucket server in the tests can now answer a reply with a chosen status, to reach these paths.
|
Claude finished @mbevc1's task in 44s —— View job Follow-up review of commits
|
…ssions The pull request details error reached only on a 201 or 202 told the user to review repository permissions, which a success status does not suggest. Both Bitbucket errors on that path now say the reply was not the 200 OK the code reads. The tests match the whole message. Also pins the evaluate error for a server message that is present but empty, which reports the status alone.
Several errors outside the API client still report a bare status code, so a reader has to know what
403or202means. They now use the sameHTTPStatushelper as the API client:upload refused with HTTP 403: BadDigest: …upload refused with HTTP 403 Forbidden: BadDigest: …kosli evaluateremote policy fetchfailed to fetch policy from <url>: HTTP 404… HTTP 404 Not Foundkosli evaluateserver-side refusalthe Kosli server answered 403: …the Kosli server answered HTTP 403 Forbidden: …got HTTP status 202got HTTP 202 AcceptedHTTPStatusis exported frominternal/requestsso the other packages can use it (first commit, a rename only).Stacked on #1349. The base will move to
mainonce it merges.Checklist
charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR (not needed)