twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Support more body types in HTTP Request action

Open Devessier opened this issue 4 months ago • 1 comments

Scope & Context

I started to do some work on this branch: https://github.com/twentyhq/twenty/compare/main...bd-json-fields

Current behavior

Only JSON bodies can be sent.

Expected behavior

We might want to send other types of request bodies, like form data. It would be great to support out of the box the following types:

  • application/json
  • multipart/form-data
  • application/x-www-form-urlencoded
  • text/plain

It corresponds to the options available in Postman.

Image

The form could look like this:

https://github.com/user-attachments/assets/a751c810-22f2-4ba2-afe0-eac52e2f8934

Technical challenges

Ensure retrocompatibility

All bodies were JSON previously, we must ensure they keep working while we add more options; it might involve writing a migration command

Content-Type header management

Postman sets some headers by default but hides them. When selecting a specific body type, a default Content-Type will be set, such as application/json. Postman allows users to override this default Content-Type. We should determine how we want to handle this.

One great thing about axios is that once you've set the Content-Type of your request, it will serialize the body correctly.

Devessier avatar Jun 27 '25 16:06 Devessier