fix: fixed issues with creating patch requests

This commit is contained in:
Anoop M D 2023-02-17 13:55:23 +05:30
parent e1b97643bd
commit 17ded5de4c
3 changed files with 12 additions and 3 deletions

View File

@ -25,7 +25,7 @@ const NewFolder = ({ collection, item, onClose }) => {
if(item && item.uid) {
return true;
}
return !(value.trim().toLowerCase().includes('environments'))
return value && !(value.trim().toLowerCase().includes('environments'))
}
})
}),

View File

@ -30,7 +30,7 @@ const NewRequest = ({ collection, item, isEphermal, onClose }) => {
.test({
name: 'requestName',
message: 'The request name "index" is reserved in bruno',
test: value => !(value.trim().toLowerCase().includes('index')),
test: value => value && !(value.trim().toLowerCase().includes('index')),
})
}),
onSubmit: (values) => {

View File

@ -57,11 +57,12 @@ const grammar = ohm.grammar(`Bru {
meta = "meta" dictionary
http = get | post | put | delete | options | head | connect | trace
http = get | post | put | delete | patch | options | head | connect | trace
get = "get" dictionary
post = "post" dictionary
put = "put" dictionary
delete = "delete" dictionary
patch = "patch" dictionary
options = "options" dictionary
head = "head" dictionary
connect = "connect" dictionary
@ -237,6 +238,14 @@ const sem = grammar.createSemantics().addAttribute('ast', {
}
};
},
patch(_1, dictionary) {
return {
http: {
method: 'patch',
...mapPairListToKeyValPair(dictionary.ast)
}
};
},
options(_1, dictionary) {
return {
http: {