6#include <azure/core/http/policies/policy.hpp>
11namespace Azure {
namespace Data {
namespace Tables {
namespace _detail {
namespace Policies {
13 class ServiceVersionPolicy final :
public Azure::Core::Http::Policies::HttpPolicy {
14 constexpr static const char* HttpHeaderXMsVersion =
"x-ms-version";
17 explicit ServiceVersionPolicy(std::string apiVersion) : m_apiVersion{std::move(apiVersion)} {}
19 std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy> Clone()
const override
21 return std::make_unique<ServiceVersionPolicy>(*
this);
24 std::unique_ptr<Azure::Core::Http::RawResponse> Send(
25 Azure::Core::Http::Request& request,
26 Azure::Core::Http::Policies::NextHttpPolicy nextPolicy,
27 const Azure::Core::Context& context)
const override
29 if (!m_apiVersion.empty())
31 request.SetHeader(HttpHeaderXMsVersion, m_apiVersion);
33 return nextPolicy.Send(request, context);
37 std::string m_apiVersion;