HTTP Request - form data - how to specify content-type for some field

Describe the problem/error/question

I need to execute an HTTP request with form-data, where for 1 of the fields a content type is specified.

In Postman it look like following

When I create a cUrl snippet from this request in Postman - it look like this:

curl --location ‘http://someUrl’ \

–form ‘data=“Some sample text about some very important topic”’ \

–form ‘params=“{\“projectId\” : [\“1223\”], \“showMatchingDetails\”:true, \“showMatchingPosition\”: true}”;type=application/json

Please note the type of the params field at the end.

So when I create a simple workflow with HTTP Request - I do not see where can I specify the content type of the params field:

When I execute the workflow - I got an error that Content-Type is wrong.

I also tried with Form-Data - the same error:

I also tried import the cURL - same error.

So my question is - is there any way to specify a Content-type for a specific field in form-data request ?

What is the error message (if any)?

500 - “{\“voidResponse\”:{\“success\”:false,\“status\”:500,\“message\”:\“Content-Type ‘application/x-www-form-urlencoded’ is not supported\”,\“resultType\”:\“text/plain\”,\“result\”:null}}”

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.21.7
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Windows

Hi @Daniil_Dukat

Can you try this?

  1. Code Node: It creates a binary property called data. Crucially, it sets the mimeType to application/json.
  2. HTTP Request Node:
    • Body Content Type: Set to multipart-form-data.
    • Field 1 (data): A standard text field mapping to the JSON output of the Code node.
    • Field 2 (params): The parameterType is set to formBinaryData and the inputDataFieldName is set to data. This tells n8n to take the binary object we created and send it with its associated MIME type (application/json).

Sure, will try now. Thanks

Hey @kjooleng - thanks a lot, that works! :clinking_beer_mugs:

Glad to help…