fix: ensure tags are always an array in bruToJson function (#7631)

Updated the bruToJson function to coerce the tags property into an array, ensuring consistent data structure when processing JSON input. This change enhances the reliability of the function by preventing potential errors when tags are not provided as an array.
This commit is contained in:
Abhishek S Lal
2026-04-01 21:14:31 +05:30
committed by GitHub
parent 3c3acf33a0
commit 00bc93d3ac

View File

@@ -71,12 +71,13 @@ const bruToJson = (bru) => {
}
const sequence = _.get(json, 'meta.seq');
const tags = _.get(json, 'meta.tags', []);
const transformedJson = {
type: requestType,
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 : [],
examples: _.get(json, 'examples', []),
request: {
url: _.get(json, requestType === 'grpc-request' ? 'grpc.url' : 'http.url'),