elnormous / HTTPRequest

Single-header C++ HTTP request class
The Unlicense
942 stars 213 forks source link

Using header in request for authentification #75

Open AlexisBalzano opened 6 months ago

AlexisBalzano commented 6 months ago

Hey, how do you send a header with the authorisation token inside a request ? i tried like this but I get a bunch of errors... How should I do it ? Capture d'écran 2024-03-24 191713

richguernsey commented 3 months ago

Since the headers list is a map of string,string you just need to wrap each pair in the parent set of braces.

const auto response = request.send("GET", body, { { "Authorization", "value" } });