Skip to content

Commit

Permalink
Rename KIBANA_API_KEYWORD
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Ibragimov committed Apr 21, 2022
1 parent e8c74f7 commit 58348e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/plugins/console/common/constants/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

export const API_BASE_PATH = '/api/console';
export const KIBANA_API_KEYWORD = 'kbn:';
export const KIBANA_API_PREFIX = 'kbn:';
2 changes: 1 addition & 1 deletion src/plugins/console/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

export { MAJOR_VERSION } from './plugin';
export { API_BASE_PATH, KIBANA_API_KEYWORD } from './api';
export { API_BASE_PATH, KIBANA_API_PREFIX } from './api';
6 changes: 3 additions & 3 deletions src/plugins/console/public/lib/es/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type { HttpResponse, HttpSetup } from '@kbn/core/public';
import { trimStart } from 'lodash';
import { API_BASE_PATH, KIBANA_API_KEYWORD } from '../../../common/constants';
import { API_BASE_PATH, KIBANA_API_PREFIX } from '../../../common/constants';

const esVersion: string[] = [];

Expand Down Expand Up @@ -68,12 +68,12 @@ export async function send({
}

function getKibanaRequestUrl(path: string) {
const isKibanaApiRequest = path.startsWith(KIBANA_API_KEYWORD);
const isKibanaApiRequest = path.startsWith(KIBANA_API_PREFIX);
const kibanaBasePath = window.location.origin;

if (isKibanaApiRequest) {
// window.location.origin is used as a Kibana public base path for sending requests in cURL commands. E.g. "Copy as cURL".
return `${kibanaBasePath}/${trimStart(path.replace(KIBANA_API_KEYWORD, ''), '/')}`;
return `${kibanaBasePath}/${trimStart(path.replace(KIBANA_API_PREFIX, ''), '/')}`;
}
}

Expand Down

0 comments on commit 58348e1

Please sign in to comment.