Skip to content

Commit 1de75d6

Browse files
committed
Edge request validation and filtering
1 parent 0e38fe6 commit 1de75d6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "labelzoom-cf-api-proxy",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"private": true,
55
"scripts": {
66
"deploy": "wrangler deploy",

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ async function proxyRequestToBackend(request: Request, url: URL, env: Env, reque
9191
export default {
9292
async fetch(request, env, ctx): Promise<Response> {
9393
const url = new URL(request.url);
94+
95+
// Edge request validation and filtering
96+
if (url.pathname.startsWith('/api/v2/')) {
97+
if (request.headers.get('Content-Type')?.toLowerCase().startsWith('multipart/form-data')) return Response.json({message:"multipart/form-data is not supported. Please see our API documentation at https://api.labelzoom.net/api"}, { status: 400 });
98+
}
9499

95100
// API modifiers
96101
if (url.pathname.startsWith('/api/')) {

0 commit comments

Comments
 (0)