Merge pull request #4083 from adamdmharvey/support-bad-request
kubernetes-backend: Support HTTP 400 Bad Request
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-backend': patch
|
||||
---
|
||||
|
||||
Support HTTP 400 Bad Request from Kubernetes API
|
||||
@@ -197,6 +197,27 @@ describe('KubernetesClientProvider', () => {
|
||||
});
|
||||
// they're in testErrorResponse
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should return pods, bad request error', async () => {
|
||||
await testErrorResponse(
|
||||
{
|
||||
response: {
|
||||
statusCode: 400,
|
||||
request: {
|
||||
uri: {
|
||||
pathname: '/some/path',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
errorType: 'BAD_REQUEST',
|
||||
resourcePath: '/some/path',
|
||||
statusCode: 400,
|
||||
},
|
||||
);
|
||||
});
|
||||
// they're in testErrorResponse
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should return pods, unauthorized error', async () => {
|
||||
await testErrorResponse(
|
||||
{
|
||||
|
||||
@@ -74,6 +74,8 @@ function fetchResultsToResponseWrapper(
|
||||
|
||||
const statusCodeToErrorType = (statusCode: number): KubernetesErrorTypes => {
|
||||
switch (statusCode) {
|
||||
case 400:
|
||||
return 'BAD_REQUEST';
|
||||
case 401:
|
||||
return 'UNAUTHORIZED_ERROR';
|
||||
case 500:
|
||||
|
||||
@@ -135,6 +135,7 @@ export interface KubernetesClustersSupplier {
|
||||
}
|
||||
|
||||
export type KubernetesErrorTypes =
|
||||
| 'BAD_REQUEST'
|
||||
| 'UNAUTHORIZED_ERROR'
|
||||
| 'SYSTEM_ERROR'
|
||||
| 'UNKNOWN_ERROR';
|
||||
|
||||
Reference in New Issue
Block a user