From 980bff9b47317cfc1a758a358b39b9dc0ae17400 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Thu, 8 Aug 2024 14:57:29 -0400 Subject: [PATCH] add comment describing the need for the formData middleware (#156) --- src/http-api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/http-api.ts b/src/http-api.ts index 7629237..8d2fce3 100644 --- a/src/http-api.ts +++ b/src/http-api.ts @@ -84,7 +84,10 @@ export class HttpApi { #setupMiddleware(): void { this.#api.use(cors({ exposedHeaders: 'dwn-response' })); this.#api.use(express.json()); - this.#api.use(express.urlencoded({ extended: true })); // formdata middleware + + // We enable the formData middleware to handle multipart/form-data requests. + // This is necessary for the endpoints used by the Web5 Connect Server/OIDC flow. + this.#api.use(express.urlencoded({ extended: true })); this.#api.use( responseTime((req: Request, res: Response, time) => { const url = req.url === '/' ? '/jsonrpc' : req.url;