-
Notifications
You must be signed in to change notification settings - Fork 61
httpclient: Add ability to pass custom headers #1251
Conversation
Feel free to reject this PR. My team has a small set of out-of-tree patches we have that would never be of interest to you guys. I thought this one might be innocent enough to try and get upstream. |
This seems harmless, and I'm open to it. @lbonn and @eu-smirnov any opinions? |
Yes, we can probably merge it |
src/libaktualizr/http/httpclient.cc
Outdated
@@ -46,7 +46,8 @@ static size_t writeString(void* contents, size_t size, size_t nmemb, void* userp | |||
return size * nmemb; | |||
} | |||
|
|||
HttpClient::HttpClient() : user_agent(std::string("Aktualizr/") + aktualizr_version()) { | |||
HttpClient::HttpClient(std::vector<std::string>* extra_headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be **const** std::vector<std::string>*
, just minor comment.
It harmless as long as an user knows what he/she/it does :), there are number of headers that can lead to not desired response, e.g. Last-Modified / If-Modified-Since / E-Tag, etc. |
I made the argument |
Would you mind adding a small unit test to |
This allows custom users of libaktualizr to pass custom headers with HTTP requests sent to the server. Signed-off-by: Andy Doan <andy@foundries.io>
Good idea on the test. I've added one that takes advantage of the fact the fake server has a test the checks the Authorization header. |
This allows custom users of libaktualizr to pass custom headers
with HTTP requests sent to the server.
Signed-off-by: Andy Doan andy@foundries.io