mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-29 03:13:45 +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
|
bodymultipart = "body:multipart-form" dictionary
|
||||||
|
|
||||||
script = scriptreq | scriptres
|
script = scriptreq | scriptres
|
||||||
scriptreq = "script:req" st* "{" nl* textblock tagend
|
scriptreq = "script:pre-request" st* "{" nl* textblock tagend
|
||||||
scriptres = "script:res" st* "{" nl* textblock tagend
|
scriptres = "script:post-response" st* "{" nl* textblock tagend
|
||||||
tests = "tests" st* "{" nl* textblock tagend
|
tests = "tests" st* "{" nl* textblock tagend
|
||||||
docs = "docs" st* "{" nl* textblock tagend
|
docs = "docs" st* "{" nl* textblock tagend
|
||||||
}`);
|
}`);
|
||||||
|
@ -211,7 +211,7 @@ ${indentString(body.xml)}
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(script && script.req && script.req.length) {
|
if(script && script.req && script.req.length) {
|
||||||
bru += `script:req {
|
bru += `script:pre-request {
|
||||||
${indentString(script.req)}
|
${indentString(script.req)}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ ${indentString(script.req)}
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(script && script.res && script.res.length) {
|
if(script && script.res && script.res.length) {
|
||||||
bru += `script:res {
|
bru += `script:post-response {
|
||||||
${indentString(script.res)}
|
${indentString(script.res)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ assert {
|
|||||||
~$res.body.message: success
|
~$res.body.message: success
|
||||||
}
|
}
|
||||||
|
|
||||||
script:req {
|
script:pre-request {
|
||||||
const foo = 'bar';
|
const foo = 'bar';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ const parser = require("../src/bruToJson");
|
|||||||
describe("script parser", () => {
|
describe("script parser", () => {
|
||||||
it("should parse request script", () => {
|
it("should parse request script", () => {
|
||||||
const input = `
|
const input = `
|
||||||
script:req {
|
script:pre-request {
|
||||||
$req.setHeader('Content-Type', 'application/json');
|
$req.setHeader('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -22,7 +22,7 @@ script:req {
|
|||||||
|
|
||||||
it("should parse response script", () => {
|
it("should parse response script", () => {
|
||||||
const input = `
|
const input = `
|
||||||
script:res {
|
script:post-response {
|
||||||
expect(response.status).to.equal(200);
|
expect(response.status).to.equal(200);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user