dfleury2 / beauty

A Simple C++ Http server/client above Boost.Beast
MIT License
188 stars 23 forks source link

HTTP Client supports request headers #24

Closed ceyert closed 1 year ago

ceyert commented 1 year ago

Hi, Is beauty client supports to request headers? I checked at client.hpp and could not able to find it.

dfleury2 commented 1 year ago

Hi, yes it should. You will need to use the "low" level send_request method, and create your request manually like in get_before method for example.

When creating this request, you will have access to header (as in Boost.beast).

Regards,

something like that (not tested, but you have the idea)

beauty::request request;
request.method(beast::http::verb::post);
request.set("X-MyHeaderLogin", "login");
request.set("X-MyHeaderPassword", "password");

client.send_request(request, ...)