Skip to content

Commit

Permalink
feat: Reduce post limit, fixes #31 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun authored and gja committed Mar 29, 2019
1 parent 0abbaec commit 000c435
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/__tests__/server_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,20 @@ describe("server", () => {
.get("/some-route")
.expect(200, "value");
});

it("allows big post request", async () => {
let body = "x"
for (let i = 0; i < 20; i++) {
body = body + body
}

const app = createApp(
'addEventListener("fetch", (e) => e.respondWith(e.request.text().then(text => new Response(`${e.request.method}`))))'
);

await supertest(app)
.post("/some-route")
.send(body)
.expect(200, 'POST');
});
});
2 changes: 1 addition & 1 deletion app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function createApp(workerContent, opts = {}) {
let workersByOrigin = {};
const kvStores = buildKVStores(new InMemoryKVStore(), opts.kvStores || []);
const app = express();
app.use(bodyParser.raw({ type: "*/*" }));
app.use(bodyParser.raw({ type: "*/*", limit: "100GB" }));
app.use(async (req, res) => {
try {
const origin = req.headers.host;
Expand Down

0 comments on commit 000c435

Please sign in to comment.