mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
feat: deprecated form-url-encoded in favour of form-urlencoded in body type in bru lang
This commit is contained in:
parent
84ce75263b
commit
0c42298ce6
@ -55,10 +55,8 @@ script
|
|||||||
/script
|
/script
|
||||||
|
|
||||||
assert
|
assert
|
||||||
{
|
1 $res.data.order.items.length 1
|
||||||
"$res.data.order.items.length": 1,
|
1 $res.data.orderNumber.isDefined true
|
||||||
"$res.data.orderNumber.isDefined": true
|
|
||||||
}
|
|
||||||
/assert
|
/assert
|
||||||
|
|
||||||
docs
|
docs
|
||||||
|
@ -85,8 +85,22 @@ const line = sequenceOf([
|
|||||||
const lines = many(line);
|
const lines = many(line);
|
||||||
const keyvalLines = sepBy(newline)(lines);
|
const keyvalLines = sepBy(newline)(lines);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We have deprecated form-url-encoded type in body tag, it was a misspelling on my part
|
||||||
|
* The new type is form-urlencoded
|
||||||
|
*
|
||||||
|
* Very few peope would have used this. I launched this to the public on 22 Jan 2023
|
||||||
|
* And I am making the change on 23 Jan 2023
|
||||||
|
*
|
||||||
|
* This deprecated tag can be removed on 1 April 2023
|
||||||
|
*/
|
||||||
|
|
||||||
// body(type=form-url-encoded)
|
// body(type=form-url-encoded)
|
||||||
const bodyFormUrlEncoded = regex(/^body\s*\(\s*type\s*=\s*form-url-encoded\s*\)\s*\r?\n/);
|
const bodyFormUrlEncodedDeprecated = regex(/^body\s*\(\s*type\s*=\s*form-url-encoded\s*\)\s*\r?\n/);
|
||||||
|
|
||||||
|
// body(type=form-urlencoded)
|
||||||
|
const bodyFormUrlEncoded = regex(/^body\s*\(\s*type\s*=\s*form-urlencoded\s*\)\s*\r?\n/);
|
||||||
|
|
||||||
// body(type=multipart-form)
|
// body(type=multipart-form)
|
||||||
const bodyMultipartForm = regex(/^body\s*\(\s*type\s*=\s*multipart-form\s*\)\s*\r?\n/);
|
const bodyMultipartForm = regex(/^body\s*\(\s*type\s*=\s*multipart-form\s*\)\s*\r?\n/);
|
||||||
@ -96,6 +110,14 @@ const bodyMultipartForm = regex(/^body\s*\(\s*type\s*=\s*multipart-form\s*\)\s*\
|
|||||||
// todo: fix this
|
// todo: fix this
|
||||||
const bodyEndRelaxed = regex(/^[\r?\n]*\/body\s*[\r?\n]*/);
|
const bodyEndRelaxed = regex(/^[\r?\n]*\/body\s*[\r?\n]*/);
|
||||||
|
|
||||||
|
const bodyFormUrlEncodedTagDeprecated = between(bodyFormUrlEncodedDeprecated)(bodyEndRelaxed)(keyvalLines).map(([result]) => {
|
||||||
|
return {
|
||||||
|
body: {
|
||||||
|
formUrlEncoded: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const bodyFormUrlEncodedTag = between(bodyFormUrlEncoded)(bodyEndRelaxed)(keyvalLines).map(([result]) => {
|
const bodyFormUrlEncodedTag = between(bodyFormUrlEncoded)(bodyEndRelaxed)(keyvalLines).map(([result]) => {
|
||||||
return {
|
return {
|
||||||
body: {
|
body: {
|
||||||
@ -117,6 +139,7 @@ module.exports = {
|
|||||||
bodyGraphqlTag,
|
bodyGraphqlTag,
|
||||||
bodyTextTag,
|
bodyTextTag,
|
||||||
bodyXmlTag,
|
bodyXmlTag,
|
||||||
|
bodyFormUrlEncodedTagDeprecated,
|
||||||
bodyFormUrlEncodedTag,
|
bodyFormUrlEncodedTag,
|
||||||
bodyMultipartFormTag
|
bodyMultipartFormTag
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,7 @@ const {
|
|||||||
bodyGraphqlTag,
|
bodyGraphqlTag,
|
||||||
bodyTextTag,
|
bodyTextTag,
|
||||||
bodyXmlTag,
|
bodyXmlTag,
|
||||||
|
bodyFormUrlEncodedTagDeprecated,
|
||||||
bodyFormUrlEncodedTag,
|
bodyFormUrlEncodedTag,
|
||||||
bodyMultipartFormTag
|
bodyMultipartFormTag
|
||||||
} = require('./body-tag');
|
} = require('./body-tag');
|
||||||
@ -33,6 +34,7 @@ const bruToJson = (fileContents) => {
|
|||||||
bodyGraphqlTag,
|
bodyGraphqlTag,
|
||||||
bodyTextTag,
|
bodyTextTag,
|
||||||
bodyXmlTag,
|
bodyXmlTag,
|
||||||
|
bodyFormUrlEncodedTagDeprecated,
|
||||||
bodyFormUrlEncodedTag,
|
bodyFormUrlEncodedTag,
|
||||||
bodyMultipartFormTag,
|
bodyMultipartFormTag,
|
||||||
scriptTag,
|
scriptTag,
|
||||||
@ -155,7 +157,7 @@ ${indentString(body.xml)}
|
|||||||
|
|
||||||
if(body && body.formUrlEncoded && body.formUrlEncoded.length) {
|
if(body && body.formUrlEncoded && body.formUrlEncoded.length) {
|
||||||
bru += `
|
bru += `
|
||||||
body(type=form-url-encoded)
|
body(type=form-urlencoded)
|
||||||
${body.formUrlEncoded.map(item => ` ${item.enabled ? 1 : 0} ${item.name} ${item.value}`).join('\n')}
|
${body.formUrlEncoded.map(item => ` ${item.enabled ? 1 : 0} ${item.name} ${item.value}`).join('\n')}
|
||||||
/body
|
/body
|
||||||
`;
|
`;
|
||||||
|
@ -40,7 +40,7 @@ body(type=xml)
|
|||||||
<body>back to the ice age</body>
|
<body>back to the ice age</body>
|
||||||
/body
|
/body
|
||||||
|
|
||||||
body(type=form-url-encoded)
|
body(type=form-urlencoded)
|
||||||
1 username john
|
1 username john
|
||||||
0 password {{password}}
|
0 password {{password}}
|
||||||
/body
|
/body
|
||||||
|
Loading…
Reference in New Issue
Block a user