Skip to content

Commit

Permalink
refactor "deprecation" to "warning"
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Mar 10, 2021
1 parent 3c6d47e commit 0dcb165
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { extractDeprecationMessages } from '../../../lib/utils';
import { extractWarningMessages } from '../../../lib/utils';
import { XJson } from '../../../../../es_ui_shared/public';
const { collapseLiteralStrings } = XJson;
// @ts-ignore
Expand Down Expand Up @@ -88,8 +88,8 @@ export function sendRequestToES(args: EsRequestArgs): Promise<ESRequestResult[]>

const warnings = xhr.getResponseHeader('warning');
if (warnings) {
const deprecationMessages = extractDeprecationMessages(warnings);
value = deprecationMessages.join('\n') + '\n' + value;
const warningMessages = extractWarningMessages(warnings);
value = warningMessages.join('\n') + '\n' + value;
}

if (isMultiRequest) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console/public/lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function formatRequestBodyDoc(data: string[], indent: boolean) {
};
}

export function extractDeprecationMessages(warnings: string) {
export function extractWarningMessages(warnings: string) {
// pattern for valid warning header
const re = /\d{3} [0-9a-zA-Z!#$%&'*+-.^_`|~]+ \"((?:\t| |!|[\x23-\x5b]|[\x5d-\x7e]|[\x80-\xff]|\\\\|\\")*)\"(?: \"[^"]*\")?/;
// split on any comma that is followed by an even number of quotes
Expand Down

0 comments on commit 0dcb165

Please sign in to comment.