Move Request ctor impl to the request.cpp file instead of http.cpp (#4195)

* Move Request ctor impl to the request.cpp file instead of http.cpp

* Add the ctors to request.cpp

* Remove null body stream header from http.cpp

* Remove unused namespace using

* Add _internal using namespace for NullBodyStream

* Fix include path
This commit is contained in:
Ahson Khan 2023-01-03 16:13:05 -08:00 committed by GitHub
parent 5304a0857d
commit 6536b0c61c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -3,7 +3,6 @@
#include "azure/core/http/http.hpp"
#include "azure/core/http/policies/policy.hpp"
#include "azure/core/internal/io/null_body_stream.hpp"
#include "azure/core/url.hpp"
#include <algorithm>
@ -13,7 +12,6 @@
using namespace Azure::Core;
using namespace Azure::Core::Http;
using namespace Azure::Core::IO::_internal;
char const Azure::Core::Http::_internal::HttpShared::ContentType[] = "content-type";
char const Azure::Core::Http::_internal::HttpShared::ApplicationJson[] = "application/json";
@ -55,13 +53,3 @@ void Azure::Core::Http::_detail::RawResponseHelpers::InsertHeaderWithValidation(
// insert (override if duplicated)
headers[headerName] = headerValue;
}
Request::Request(HttpMethod httpMethod, Url url, bool shouldBufferResponse)
: Request(httpMethod, std::move(url), NullBodyStream::GetNullBodyStream(), shouldBufferResponse)
{
}
Request::Request(HttpMethod httpMethod, Url url)
: Request(httpMethod, std::move(url), NullBodyStream::GetNullBodyStream(), true)
{
}

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
#include "azure/core/http/http.hpp"
#include "azure/core/internal/io/null_body_stream.hpp"
#include "azure/core/internal/strings.hpp"
#include <map>
@ -9,6 +10,7 @@
#include <vector>
using namespace Azure::Core::Http;
using namespace Azure::Core::IO::_internal;
namespace {
// returns left map plus all items in right
@ -22,6 +24,16 @@ static Azure::Core::CaseInsensitiveMap MergeMaps(
}
} // namespace
Request::Request(HttpMethod httpMethod, Url url, bool shouldBufferResponse)
: Request(httpMethod, std::move(url), NullBodyStream::GetNullBodyStream(), shouldBufferResponse)
{
}
Request::Request(HttpMethod httpMethod, Url url)
: Request(httpMethod, std::move(url), NullBodyStream::GetNullBodyStream(), true)
{
}
Azure::Nullable<std::string> Request::GetHeader(std::string const& name)
{
for (auto const& hdrs : {m_retryHeaders, m_headers})