diff --git a/src/mastodon-cpp.cpp b/src/mastodon-cpp.cpp index 332603c..f54c117 100644 --- a/src/mastodon-cpp.cpp +++ b/src/mastodon-cpp.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include "version.hpp" @@ -265,10 +266,13 @@ return_call API::register_app2(const string &client_id, return ret; } -const string API::get_header(const std::string &header) const +const string API::get_header(std::string header) const { string headers; _http.get_headers(headers); + std::transform(headers.begin(), headers.end(), headers.begin(), ::tolower); + std::transform(header.begin(), header.end(), header.begin(), ::tolower); + size_t startpos = headers.find(header + ':'); if (startpos != std::string::npos) { diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 98c0b37..57e44f5 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -411,7 +411,7 @@ namespace Mastodon string &access_token); /*! - * @brief Gets the header from the last answer. + * @brief Gets the header from the last answer. Case insensitive. * * @param header The header to get * @@ -419,7 +419,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const string get_header(const string &header) const; + const string get_header(string header) const; /*! * @brief Turn exceptions on or off. Defaults to off.