I am encountering an issue with a simple controller that I have. Within this controller, there is an endpoint defined as follows:
@Post('/temp')
async asdf(
@Body() form: Record<string, string>,
@Res({ passthrough: true }) response: Response,
) {
this.logger.debug(JSON.stringify(form));
await response.json({ ok: true, form: JSON.stringify(form) });
}
When attempting to POST form data to this endpoint via cURL or the browser, I notice that the object form
is empty.
For example:
curl -X POST http://localhost:4000/mycontroller/temp -H "Content-Type: application/x-www-form-urlencoded" -d "param1=value1¶m2=value2"
This results in:
{"ok":true,"form":"{}"}
All other controllers are functioning properly, and upon inspection, I cannot identify any notable differences between my controller and those of others.
What could be the issue or what am I potentially missing?