diff --git a/packages/bruno-lang/src/headers-tag.js b/packages/bruno-lang/src/headers-tag.js index 5441bd00a..e371f152f 100644 --- a/packages/bruno-lang/src/headers-tag.js +++ b/packages/bruno-lang/src/headers-tag.js @@ -15,25 +15,18 @@ const { const newline = regex(/^\r?\n/); const newLineOrEndOfInput = choice([newline, endOfInput]); -const begin = sequenceOf([ - regex(/^headers[^\S\r\n]*/), - newline -]); -const end = sequenceOf([ - regex(/^\/headers[^\S\r\n]*/), - newLineOrEndOfInput -]); -const key = everyCharUntil(whitespace); -const value = everyCharUntil(whitespace); +const begin = regex(/^headers\s*\r?\n/); +const end = regex(/^[\r?\n]*\/headers\s*[\r?\n]*/); +const word = regex(/^[^\s\t\n]+/g); const line = sequenceOf([ optionalWhitespace, digit, whitespace, - key, + word, whitespace, - value, + word, newLineOrEndOfInput ]).map(([_, enabled, __, key, ___, value]) => { return { diff --git a/packages/bruno-lang/src/params-tag.js b/packages/bruno-lang/src/params-tag.js index a87c3a34f..d2cdbb02a 100644 --- a/packages/bruno-lang/src/params-tag.js +++ b/packages/bruno-lang/src/params-tag.js @@ -15,25 +15,17 @@ const { const newline = regex(/^\r?\n/); const newLineOrEndOfInput = choice([newline, endOfInput]); -const begin = sequenceOf([ - regex(/^params[^\S\r\n]*/), - newline -]); - -const end = sequenceOf([ - regex(/^\/params[^\S\r\n]*/), - newLineOrEndOfInput -]); -const key = everyCharUntil(whitespace); -const value = everyCharUntil(whitespace); +const begin = regex(/^params\s*\r?\n/); +const end = regex(/^[\r?\n]*\/params\s*[\r?\n]*/); +const word = regex(/^[^\s\t\n]+/g); const line = sequenceOf([ optionalWhitespace, digit, whitespace, - key, + word, whitespace, - value, + word, newLineOrEndOfInput ]).map(([_, enabled, __, key, ___, value]) => { return {