mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
remove deprecated header support (#112505)
This commit is contained in:
parent
7040b47840
commit
4a1a060f25
3 changed files with 1 additions and 55 deletions
|
@ -245,32 +245,6 @@ describe('Fetch', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// Deprecated header used by legacy platform pre-7.7. Remove in 8.x.
|
||||
it('should not allow overwriting of kbn-system-api when asSystemRequest: true', async () => {
|
||||
fetchMock.get('*', {});
|
||||
await expect(
|
||||
fetchInstance.fetch('/my/path', {
|
||||
headers: { myHeader: 'foo', 'kbn-system-api': 'ANOTHER!' },
|
||||
asSystemRequest: true,
|
||||
})
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid fetch headers, headers beginning with \\"kbn-\\" are not allowed: [kbn-system-api]"`
|
||||
);
|
||||
});
|
||||
|
||||
// Deprecated header used by legacy platform pre-7.7. Remove in 8.x.
|
||||
it('should not allow overwriting of kbn-system-api when asSystemRequest: false', async () => {
|
||||
fetchMock.get('*', {});
|
||||
await expect(
|
||||
fetchInstance.fetch('/my/path', {
|
||||
headers: { myHeader: 'foo', 'kbn-system-api': 'ANOTHER!' },
|
||||
asSystemRequest: false,
|
||||
})
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid fetch headers, headers beginning with \\"kbn-\\" are not allowed: [kbn-system-api]"`
|
||||
);
|
||||
});
|
||||
|
||||
it('should return response', async () => {
|
||||
fetchMock.get('*', { foo: 'bar' });
|
||||
const json = await fetchInstance.fetch('/my/path');
|
||||
|
|
|
@ -141,31 +141,6 @@ describe('KibanaRequest', () => {
|
|||
const kibanaRequest = KibanaRequest.from(request);
|
||||
expect(kibanaRequest.isSystemRequest).toBe(false);
|
||||
});
|
||||
|
||||
// Remove support for kbn-system-api header in 8.x. Only used by legacy platform.
|
||||
it('is false when no kbn-system-api header is set', () => {
|
||||
const request = httpServerMock.createRawRequest({
|
||||
headers: { custom: 'one' },
|
||||
});
|
||||
const kibanaRequest = KibanaRequest.from(request);
|
||||
expect(kibanaRequest.isSystemRequest).toBe(false);
|
||||
});
|
||||
|
||||
it('is true when kbn-system-api header is set to true', () => {
|
||||
const request = httpServerMock.createRawRequest({
|
||||
headers: { custom: 'one', 'kbn-system-api': 'true' },
|
||||
});
|
||||
const kibanaRequest = KibanaRequest.from(request);
|
||||
expect(kibanaRequest.isSystemRequest).toBe(true);
|
||||
});
|
||||
|
||||
it('is false when kbn-system-api header is set to false', () => {
|
||||
const request = httpServerMock.createRawRequest({
|
||||
headers: { custom: 'one', 'kbn-system-api': 'false' },
|
||||
});
|
||||
const kibanaRequest = KibanaRequest.from(request);
|
||||
expect(kibanaRequest.isSystemRequest).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('route.options.authRequired property', () => {
|
||||
|
|
|
@ -202,10 +202,7 @@ export class KibanaRequest<
|
|||
|
||||
this.url = request.url;
|
||||
this.headers = deepFreeze({ ...request.headers });
|
||||
this.isSystemRequest =
|
||||
request.headers['kbn-system-request'] === 'true' ||
|
||||
// Remove support for `kbn-system-api` in 8.x. Used only by legacy platform.
|
||||
request.headers['kbn-system-api'] === 'true';
|
||||
this.isSystemRequest = request.headers['kbn-system-request'] === 'true';
|
||||
|
||||
// prevent Symbol exposure via Object.getOwnPropertySymbols()
|
||||
Object.defineProperty(this, requestSymbol, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue