How to include HTTP headers by mapping?

Hello Automators!

I have a HTTP module in which I want to include a list of headers. Instead of adding them one by one, I would like to toggle the MAP switch and add them manually, however I couldn’t find a way to do it. No matter which format I pass to the module, it always returns me:
HTTP Array of objects expected in parameter ‘headers’.

I already tried the following structures:

[
            {
                "name": "content-type",
                "value": "application/json"
            },
            {
                "name": "example-name-2",
                "value": "example-value-2"
            }
]
[
            { "content-type" :"application/json" },
            { "example-name-2" : "example-value-2" }
]
[
            { 
                        "content-type" :"application/json",
                        "example-name-2" : "example-value-2"
            }
]

Does any of you know how can I include custom headers by mapping them into the module?

Thanks in advance! :slight_smile:

That’s a make.com problem.
An array is expected in the form of make.com
You must first assemble your header input into an array and then take this array as input to the module

2 Likes

Welcome to the Make community!

Your first structure is correct.

However!

That is just a JSON string representation of an array, but it is not a variable of type array.

You need to convert the JSON string into an array using the Parse JSON module.

Screenshot_2024-02-03_000227

Output:

4 Likes