mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 13:45:52 +00:00
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:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user