mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-26 00:29:11 +01:00
feat: renamed script:req,res as script:pre-request,post-response
This commit is contained in:
parent
e22f164cbc
commit
dc03b6a761
@ -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
|
||||
}`);
|
||||
|
@ -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)}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ assert {
|
||||
~$res.body.message: success
|
||||
}
|
||||
|
||||
script:req {
|
||||
script:pre-request {
|
||||
const foo = 'bar';
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
`;
|
||||
|
Loading…
Reference in New Issue
Block a user