Got request saving to work for faw files.

This commit is contained in:
Zachary Elliott 2024-08-03 18:01:18 -06:00
parent c81aded003
commit e7976e95e1
3 changed files with 18 additions and 2 deletions

View File

@ -122,7 +122,7 @@ const browseFile = async (win, filters) => {
filters
});
if(!filePaths) {
if (!filePaths || filePaths[0] === undefined) {
return null;
}

View File

@ -24,7 +24,7 @@ const { outdentString } = require('../../v1/src/utils');
const grammar = ohm.grammar(`Bru {
BruFile = (meta | http | query | params | headers | auths | bodies | varsandassert | script | tests | docs)*
auths = authawsv4 | authbasic | authbearer | authdigest | authOAuth2
bodies = bodyjson | bodytext | bodyxml | bodysparql | bodygraphql | bodygraphqlvars | bodyforms | body
bodies = bodyjson | bodytext | bodyxml | bodysparql | bodygraphql | bodygraphqlvars | bodyforms | bodyrawfile | body
bodyforms = bodyformurlencoded | bodymultipart
params = paramspath | paramsquery
@ -93,6 +93,7 @@ const grammar = ohm.grammar(`Bru {
bodyjson = "body:json" st* "{" nl* textblock tagend
bodytext = "body:text" st* "{" nl* textblock tagend
bodyxml = "body:xml" st* "{" nl* textblock tagend
bodyrawfile = "body:raw-file" st* "{" nl* textblock tagend
bodysparql = "body:sparql" st* "{" nl* textblock tagend
bodygraphql = "body:graphql" st* "{" nl* textblock tagend
bodygraphqlvars = "body:graphql:vars" st* "{" nl* textblock tagend
@ -528,6 +529,13 @@ const sem = grammar.createSemantics().addAttribute('ast', {
}
};
},
bodyrawfile(_1, _2, _3, _4, textblock, _5) {
return {
body: {
rawFile: outdentString(textblock.sourceString)
}
};
},
bodysparql(_1, _2, _3, _4, textblock, _5) {
return {
body: {

View File

@ -229,6 +229,14 @@ ${indentString(body.xml)}
${indentString(body.sparql)}
}
`;
}
if (body && body.rawFile && body.rawFile.length) {
bru += `body:raw-file {
${indentString(body.rawFile)}
}
`;
}