From 82e53ac424a5966a9cbd09f9ea1787d9bd3ae67a Mon Sep 17 00:00:00 2001 From: Mateusz Pietryga Date: Thu, 22 Aug 2024 22:17:57 +0200 Subject: [PATCH] fix: space in any param name is blocking the loading of the request file in GUI (#2878) Adjusted Bruno grammar so the `key` element does not disallow spaces (leading and trailing space is still trimmed). --- packages/bruno-lang/v2/src/bruToJson.js | 2 +- packages/bruno-lang/v2/tests/fixtures/request.bru | 2 ++ packages/bruno-lang/v2/tests/fixtures/request.json | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/bruno-lang/v2/src/bruToJson.js b/packages/bruno-lang/v2/src/bruToJson.js index 08e4332c5..53e3498d4 100644 --- a/packages/bruno-lang/v2/src/bruToJson.js +++ b/packages/bruno-lang/v2/src/bruToJson.js @@ -33,7 +33,7 @@ const grammar = ohm.grammar(`Bru { stnl = st | nl tagend = nl "}" optionalnl = ~tagend nl - keychar = ~(tagend | st | nl | ":") any + keychar = ~(tagend | "\\t" | nl | ":") any valuechar = ~(nl | tagend) any // Multiline text block surrounded by ''' diff --git a/packages/bruno-lang/v2/tests/fixtures/request.bru b/packages/bruno-lang/v2/tests/fixtures/request.bru index c4ff61558..f8d7db262 100644 --- a/packages/bruno-lang/v2/tests/fixtures/request.bru +++ b/packages/bruno-lang/v2/tests/fixtures/request.bru @@ -13,6 +13,7 @@ get { params:query { apiKey: secret numbers: 998877665 + multi word param: is allowed ~message: hello } @@ -23,6 +24,7 @@ params:path { headers { content-type: application/json Authorization: Bearer 123 + multi word header: is allowed ~transaction-id: {{transactionId}} } diff --git a/packages/bruno-lang/v2/tests/fixtures/request.json b/packages/bruno-lang/v2/tests/fixtures/request.json index d0bd996f6..0f74a8dcf 100644 --- a/packages/bruno-lang/v2/tests/fixtures/request.json +++ b/packages/bruno-lang/v2/tests/fixtures/request.json @@ -23,6 +23,12 @@ "type": "query", "enabled": true }, + { + "name" : "multi word param", + "value" : "is allowed", + "type": "query", + "enabled": true + }, { "name": "message", "value": "hello", @@ -47,6 +53,11 @@ "value": "Bearer 123", "enabled": true }, + { + "name" : "multi word header", + "value" : "is allowed", + "enabled": true + }, { "name": "transaction-id", "value": "{{transactionId}}",