mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user