-
Notifications
You must be signed in to change notification settings - Fork 8
How to put header for every request
Taymindis Woon edited this page Jun 25, 2017
·
1 revision
void simplePostOption(bcl::Request *req) {
req->headers.emplace_back("Authorization", res::mySetting[MY_BASIC_AUTH].asString());
log::messageln("The post fields = %s\n", req->args[4].getStr);
bcl::setOpts(req, CURLOPT_URL , req->args[0].getStr,
CURLOPT_FOLLOWLOCATION, req->args[1].getLong,
CURLOPT_WRITEFUNCTION, &bcl::writeContentCallback,
CURLOPT_WRITEDATA, req->dataPtr,
CURLOPT_USERAGENT, req->args[2].getStr,
CURLOPT_RANGE, req->args[3].getStr,
CURLOPT_POSTFIELDSIZE, strlen(req->args[4].getStr),
CURLOPT_COPYPOSTFIELDS, req->args[4].getStr // for copy
);
}