fix: ensure tags are always an array in parseBruRequest function (#7616)

Updated the parseBruRequest function to guarantee that the tags extracted from the JSON input are always returned as an array, improving data consistency and preventing potential errors when handling non-array values.
This commit is contained in:
Abhishek S Lal
2026-04-01 21:12:47 +05:30
committed by GitHub
parent 8c9cad6d78
commit 3c3acf33a0

View File

@@ -32,6 +32,7 @@ export const parseBruRequest = (data: string | any, parsed: boolean = false): an
}
const sequence = _.get(json, 'meta.seq');
const tags = _.get(json, 'meta.tags', []);
const urlPath: Record<typeof requestType, string> = {
'grpc-request': 'grpc.url',
'ws-request': 'ws.url',
@@ -42,7 +43,7 @@ export const parseBruRequest = (data: string | any, parsed: boolean = false): an
name: _.get(json, 'meta.name'),
seq: !_.isNaN(sequence) ? Number(sequence) : 1,
settings: _.get(json, 'settings', {}),
tags: _.get(json, 'meta.tags', []),
tags: Array.isArray(tags) ? tags : [],
request: {
// Preserving special characters in custom methods. Using _.upperCase strips special characters.
method: