-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves not found response handling in the saved objects repository (#…
…108749) (#108954) Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
- Loading branch information
1 parent
416e0ba
commit 6acf24a
Showing
13 changed files
with
452 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/core/server/elasticsearch/supported_server_response_check.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { isNotFoundFromUnsupportedServer } from './supported_server_response_check'; | ||
|
||
describe('#isNotFoundFromUnsupportedServer', () => { | ||
it('returns true with not found response from unsupported server', () => { | ||
const rawResponse = { | ||
statusCode: 404, | ||
headers: {}, | ||
}; | ||
|
||
const result = isNotFoundFromUnsupportedServer(rawResponse); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it('returns false with not found response from supported server', async () => { | ||
const rawResponse = { | ||
statusCode: 404, | ||
headers: { 'x-elastic-product': 'Elasticsearch' }, | ||
}; | ||
|
||
const result = isNotFoundFromUnsupportedServer(rawResponse); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it('returns false when not a 404', async () => { | ||
const rawResponse = { | ||
statusCode: 200, | ||
headers: { 'x-elastic-product': 'Elasticsearch' }, | ||
}; | ||
|
||
const result = isNotFoundFromUnsupportedServer(rawResponse); | ||
expect(result).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.