Skip to content

Commit 000c435

Browse files
sheerungja
authored andcommitted
feat: Reduce post limit, fixes #31 (#32)
1 parent 0abbaec commit 000c435

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

app/__tests__/server_spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,20 @@ describe("server", () => {
6666
.get("/some-route")
6767
.expect(200, "value");
6868
});
69+
70+
it("allows big post request", async () => {
71+
let body = "x"
72+
for (let i = 0; i < 20; i++) {
73+
body = body + body
74+
}
75+
76+
const app = createApp(
77+
'addEventListener("fetch", (e) => e.respondWith(e.request.text().then(text => new Response(`${e.request.method}`))))'
78+
);
79+
80+
await supertest(app)
81+
.post("/some-route")
82+
.send(body)
83+
.expect(200, 'POST');
84+
});
6985
});

app/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function createApp(workerContent, opts = {}) {
3232
let workersByOrigin = {};
3333
const kvStores = buildKVStores(new InMemoryKVStore(), opts.kvStores || []);
3434
const app = express();
35-
app.use(bodyParser.raw({ type: "*/*" }));
35+
app.use(bodyParser.raw({ type: "*/*", limit: "100GB" }));
3636
app.use(async (req, res) => {
3737
try {
3838
const origin = req.headers.host;

0 commit comments

Comments
 (0)