mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
fix: parsing dates from insomnia (#7003)
js-yaml uses DEFAULT_SCHEMA by default and implicitly casts date-like strings to Date (timestamp). This caused unexpected config values where dates were supposed to remain plain strings. Switched YAML parsing to JSON_SCHEMA to disable timestamp resolution and keep date-like values as strings.
This commit is contained in:
@@ -301,7 +301,7 @@ const parseInsomniaCollection = (data) => {
|
||||
export const insomniaToBruno = (insomniaCollection) => {
|
||||
try {
|
||||
if (typeof insomniaCollection !== 'object') {
|
||||
insomniaCollection = jsyaml.load(insomniaCollection);
|
||||
insomniaCollection = jsyaml.load(insomniaCollection, { schema: jsyaml.JSON_SCHEMA });
|
||||
}
|
||||
let collection;
|
||||
if (isInsomniaV5Export(insomniaCollection)) {
|
||||
|
||||
@@ -33,6 +33,9 @@ collection:
|
||||
isPrivate: false
|
||||
sortKey: -1744194421965
|
||||
method: GET
|
||||
parameters:
|
||||
- name: date
|
||||
value: 2022-10-28
|
||||
settings:
|
||||
renderRequestBody: true
|
||||
encodeUrl: true
|
||||
@@ -127,7 +130,14 @@ const expectedOutput = {
|
||||
},
|
||||
headers: [],
|
||||
method: 'GET',
|
||||
params: [],
|
||||
params: [
|
||||
{
|
||||
enabled: true,
|
||||
name: 'date',
|
||||
type: 'query',
|
||||
value: '2022-10-28'
|
||||
}
|
||||
],
|
||||
url: 'https://testbench-sanity.usebruno.com/ping'
|
||||
},
|
||||
seq: 1,
|
||||
|
||||
Reference in New Issue
Block a user