adding header in PUT/POST request

I want to send a POST and PUT request to a server. I need to add a header, in particular a Token, to the request.
Here is the code that I’ve written(I need to add something to that in order to append the token to the request)…


#include <ArduinoHttpClient.h>

char server = “192.168.0.24”;

int port = 8000;

HttpClient client = HttpClient(wifi, server, port);

String contentType = “application/json”;

String postData = “{“data_1”:123}”;

client.put("/update/", contentType, postData);


NOTE: the code works but for some reasons, I need to add token to the header…
I really appreciate if you tell me how I can add a token to the header of the request… Thanks a lot

The example CustomHeader.ino shows you how you can do that. Use the post part, it's rather easy to change that to a put.

Thank you so much!