Skip to content

Commit

Permalink
Merge pull request #194 from idolum/issue/193
Browse files Browse the repository at this point in the history
Allow to set the Expect header
  • Loading branch information
idolum committed Oct 28, 2021
2 parents e65792a + 925513c commit df248f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion include/ews/ews.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8401,6 +8401,12 @@ namespace internal
curl_easy_setopt(handle_.get(), CURLOPT_TIMEOUT, timeout.count());
}

void set_expect(const std::string& value)
{
const std::string str = "Expect: " + value;
headers_.append(str.c_str());
}

#ifdef EWS_HAS_VARIADIC_TEMPLATES
// Small wrapper around curl_easy_setopt(3).
//
Expand Down Expand Up @@ -8613,7 +8619,7 @@ namespace internal
request_stream << "</soap:Envelope>";

#ifdef EWS_ENABLE_VERBOSE
std::cerr << request_stream.str() << std::endl;
std::cerr << "make_raw_soap_request: " << std::endl << request_stream.str() << std::endl;
#endif
return handler.send(request_stream.str());
}
Expand Down Expand Up @@ -8643,6 +8649,7 @@ namespace internal
RequestHandler handler(url);
handler.set_method(RequestHandler::method::POST);
handler.set_content_type("text/xml; charset=utf-8");
handler.set_expect("");
ntlm_credentials creds(username, password, domain);
handler.set_credentials(creds);
return make_raw_soap_request(handler, soap_body, soap_headers);
Expand Down Expand Up @@ -9001,6 +9008,7 @@ namespace internal
handler.set_credentials(credentials);
handler.set_content_type("text/xml; charset=utf-8");
handler.set_content_length(request_string.size());
handler.set_expect("");

#ifdef EWS_ENABLE_VERBOSE
std::cerr << request_string << std::endl;
Expand Down Expand Up @@ -20944,6 +20952,11 @@ class basic_service final
}
}

void set_expect(const std::string& value)
{
request_handler_.set_expect(value);
}

private:
//! \brief CURL callback for forwarding debug output
static int curl_debug_callback(EWS_MAYBE_UNUSED CURL* handle,
Expand Down

0 comments on commit df248f8

Please sign in to comment.