Skip to content

Commit 9acbefc

Browse files
authored
Honor type via either query param or body for POST requests (#707)
1 parent 5481fe0 commit 9acbefc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,10 @@ app.post("/", async (req, res) => {
228228
: // assume it's an HTML file
229229
tempFilePath;
230230

231-
const generatorType = new URLSearchParams(req.body).get("type");
231+
const generatorType =
232+
new URLSearchParams(req.body).get("type") || "" + req.query.type;
232233
if (!generatorType) {
233-
res.status(400).send("Missing type in POST body");
234+
res.status(400).send("Missing type in POST body or query params");
234235
return;
235236
}
236237
if (!isGeneratorType(generatorType)) {

0 commit comments

Comments
 (0)