Split out curl and winhttp testing on WS2022 to work around CURL bias in test proxy tests (#5071)
* Split out curl an winhttp testing on WS2022 to work around CURL bias in test proxy tests * Minor change to storage to trigger CI pipeline * On testing builds, send a 0 length Content-Length header on Patch verbs if the caller has not provided a Content-Length header. * Update sdk/core/azure-core/inc/azure/core/http/http.hpp Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> --------- Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>
This commit is contained in:
parent
2c8143a702
commit
2337ee796e
@ -85,8 +85,13 @@
|
||||
}
|
||||
},
|
||||
"TargetPlatform": {
|
||||
"Win32Api_debug_tests": {
|
||||
"CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DBUILD_TRANSPORT_WINHTTP=ON -DMSVC_USE_STATIC_CRT=ON",
|
||||
"Win32Api_debug_tests_curl": {
|
||||
"CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DMSVC_USE_STATIC_CRT=ON",
|
||||
"BuildArgs": "--parallel 8 --config Debug",
|
||||
"PublishMapFiles": "true"
|
||||
},
|
||||
"Win32Api_debug_tests_winhttp": {
|
||||
"CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DMSVC_USE_STATIC_CRT=ON",
|
||||
"BuildArgs": "--parallel 8 --config Debug",
|
||||
"PublishMapFiles": "true"
|
||||
}
|
||||
|
||||
@ -311,6 +311,12 @@ namespace Azure { namespace Core { namespace Http {
|
||||
*/
|
||||
Azure::Core::IO::BodyStream* GetBodyStream() { return this->m_bodyStream; }
|
||||
|
||||
/**
|
||||
* @brief Get HTTP body as #Azure::Core::IO::BodyStream.
|
||||
*
|
||||
*/
|
||||
Azure::Core::IO::BodyStream const* GetBodyStream() const { return this->m_bodyStream; }
|
||||
|
||||
/**
|
||||
* @brief A value indicating whether the returned raw response for this request will be buffered
|
||||
* within a memory buffer or if it will be returned as a body stream instead.
|
||||
|
||||
@ -202,13 +202,32 @@ std::string GetHeadersAsString(Azure::Core::Http::Request const& request)
|
||||
{
|
||||
std::string requestHeaderString;
|
||||
|
||||
for (auto const& header : request.GetHeaders())
|
||||
// request.GetHeaders() aggregates the pre- and post-retry headers into a single map. Capture it
|
||||
// so we don't recalculate the merge multiple times.
|
||||
auto requestHeaders = request.GetHeaders();
|
||||
|
||||
for (auto const& header : requestHeaders)
|
||||
{
|
||||
requestHeaderString += header.first; // string (key)
|
||||
requestHeaderString += ": ";
|
||||
requestHeaderString += header.second; // string's value
|
||||
requestHeaderString += "\r\n";
|
||||
}
|
||||
|
||||
// The test recording infrastructure requires that a Patch verb have a Content-Length header,
|
||||
// because it does not distinguish between requests with and without a body if there's no
|
||||
// Content-Length header.
|
||||
if (request.GetMethod() == HttpMethod::Patch)
|
||||
{
|
||||
if (requestHeaders.find("Content-Length") == requestHeaders.end())
|
||||
{
|
||||
if (request.GetBodyStream() == nullptr || request.GetBodyStream()->Length() == 0)
|
||||
{
|
||||
requestHeaderString += "Content-Length: 0\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
requestHeaderString += "\r\n";
|
||||
|
||||
return requestHeaderString;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user