feat: renamed script:req,res as script:pre-request,post-response

This commit is contained in:
Anoop M D 2023-02-07 04:39:23 +05:30
parent e22f164cbc
commit dc03b6a761
4 changed files with 7 additions and 7 deletions

View File

@ -80,8 +80,8 @@ const grammar = ohm.grammar(`Bru {
bodymultipart = "body:multipart-form" dictionary
script = scriptreq | scriptres
scriptreq = "script:req" st* "{" nl* textblock tagend
scriptres = "script:res" st* "{" nl* textblock tagend
scriptreq = "script:pre-request" st* "{" nl* textblock tagend
scriptres = "script:post-response" st* "{" nl* textblock tagend
tests = "tests" st* "{" nl* textblock tagend
docs = "docs" st* "{" nl* textblock tagend
}`);

View File

@ -211,7 +211,7 @@ ${indentString(body.xml)}
}
if(script && script.req && script.req.length) {
bru += `script:req {
bru += `script:pre-request {
${indentString(script.req)}
}
@ -219,7 +219,7 @@ ${indentString(script.req)}
}
if(script && script.res && script.res.length) {
bru += `script:res {
bru += `script:post-response {
${indentString(script.res)}
}

View File

@ -84,7 +84,7 @@ assert {
~$res.body.message: success
}
script:req {
script:pre-request {
const foo = 'bar';
}

View File

@ -6,7 +6,7 @@ const parser = require("../src/bruToJson");
describe("script parser", () => {
it("should parse request script", () => {
const input = `
script:req {
script:pre-request {
$req.setHeader('Content-Type', 'application/json');
}
`;
@ -22,7 +22,7 @@ script:req {
it("should parse response script", () => {
const input = `
script:res {
script:post-response {
expect(response.status).to.equal(200);
}
`;