diff --git a/packages/bruno-lang/v1/src/body-tag.js b/packages/bruno-lang/v1/src/body-tag.js index f848e3af..b1caf3b7 100644 --- a/packages/bruno-lang/v1/src/body-tag.js +++ b/packages/bruno-lang/v1/src/body-tag.js @@ -16,7 +16,7 @@ const bodyTextBegin = regex(/^body\s*\(\s*type\s*=\s*text\s*\)\s*\r?\n/); // body(type=xml) const bodyXmlBegin = regex(/^body\s*\(\s*type\s*=\s*xml\s*\)\s*\r?\n/); -// body(type=rawFile) +// body(type=raw-file) const bodyRawFile = regex(/^body\s*\(\s*type\s*=\s*raw-file\s*\)\s*\r?\n/); const bodyEnd = regex(/^[\r?\n]+\/body\s*[\r?\n]*/); @@ -66,13 +66,13 @@ const bodyXmlTag = between(bodyXmlBegin)(bodyEnd)(everyCharUntil(bodyEnd)).map(( }); -const bodyRawFileTag = between(bodyRawFile)(bodyEnd)(everyCharUntil(bodyEnd)).map((bodyRawFile)) => { +const bodyRawFileTag = between(bodyRawFile)(bodyEnd)(everyCharUntil(bodyEnd)).map((bodyRawFile) => { return { body: { rawFile: bodyRawFile } - } -} + }; +}); /** * We have deprecated form-url-encoded type in body tag, it was a misspelling on my part diff --git a/packages/bruno-lang/v1/tests/fixtures/request.bru b/packages/bruno-lang/v1/tests/fixtures/request.bru index a96dcef2..e3dccf34 100644 --- a/packages/bruno-lang/v1/tests/fixtures/request.bru +++ b/packages/bruno-lang/v1/tests/fixtures/request.bru @@ -50,6 +50,10 @@ body(type=multipart-form) 0 password governingdynamics /body +body(type=raw-file) + /test/file.txt +/body + script const foo='bar'; /script diff --git a/packages/bruno-lang/v1/tests/json-to-bru.spec.js b/packages/bruno-lang/v1/tests/json-to-bru.spec.js index 9b2b7135..c28b2791 100644 --- a/packages/bruno-lang/v1/tests/json-to-bru.spec.js +++ b/packages/bruno-lang/v1/tests/json-to-bru.spec.js @@ -77,7 +77,8 @@ describe('bruToJson', () => { name: 'password', value: 'governingdynamics' } - ] + ], + rawFile: '/test/file.txt' }, script: "const foo='bar';", tests: "bruno.test('200 ok', () => {});"