Error 400 Bad Request for Put and Post Request

i am trying to do a put request to the Jira API via a c++ script.
I am using the c++ library “httplib” which works for Get Request.

My headers are looking like that:

httplib::Headers headers = {
            {"Accept", "application/json"},
			{"Content-Type", "application/json"},
			{"Authorization", "Basic " + getKey()},

My Put request looks like that:

httplib::Client cli(_baseUrl.c_str());
	std::string url = "/rest/api/2/issue/CTUS-3701";

    std::string body = "{\"fields\":{\"summary\":\"TestTestTest\"}}";

    size_t bodySize = body.size();

    auto res = cli.Put(url.c_str(), createHeaders(), body.c_str(), bodySize, "application/json");

The baseurl gets prepended to the url inside of the Put function.

Every time i do that request i get the error code “400 Bad Request” without any other error message.

If i do the same request via a different tool like Postman it is working as its supposed to do.

Thanks for any help in advance!