Tag support in jsonToToml and tomlToJson

This commit is contained in:
Antti Sonkeri
2024-07-27 11:45:57 +03:00
parent 540cc234d7
commit 570be81467
4 changed files with 11 additions and 0 deletions

View File

@@ -47,6 +47,10 @@ const jsonToToml = (json) => {
}
};
if (json.tags && json.tags.length) {
formattedJson.tags = get(json, 'tags', []);
}
if (json.headers && json.headers.length) {
const hasDuplicateHeaders = keyValPairHasDuplicateKeys(json.headers);
const hasReservedHeaders = keyValPairHasReservedKeys(json.headers);

View File

@@ -24,6 +24,10 @@ const tomlToJson = (toml) => {
}
};
if (json.tags && json.tags.length) {
formattedJson.tags = get(json, 'tags', []);
}
if (json.headers) {
formattedJson.headers = [];

View File

@@ -4,6 +4,7 @@
"type": "http",
"seq": 1
},
"tags": ["foo", "bar"],
"http": {
"method": "GET",
"url": "https://reqres.in/api/users"

View File

@@ -1,3 +1,5 @@
tags = [ 'foo', 'bar' ]
[meta]
name = 'Get users'
type = 'http'