azure-core
transport.hpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
9 #pragma once
10 
11 #include "azure/core/context.hpp"
12 #include "azure/core/http/http.hpp"
13 
14 namespace Azure { namespace Core { namespace Http {
15 
19  class HttpTransport {
20  public:
21  // If we get a response that goes up the stack
22  // Any errors in the pipeline throws an exception
23  // At the top of the pipeline we might want to turn certain responses into exceptions
24 
31  // TODO - Should this be const
32  virtual std::unique_ptr<RawResponse> Send(Request& request, Context const& context) = 0;
33 
38  virtual ~HttpTransport() {}
39 
40  protected:
45  HttpTransport() = default;
46 
52  HttpTransport(const HttpTransport& other) = default;
53 
59  HttpTransport(HttpTransport&& other) = default;
60 
68  HttpTransport& operator=(const HttpTransport& other) = default;
69 
74  virtual bool HasWebSocketSupport() const { return false; }
75  };
76 
77 }}} // namespace Azure::Core::Http
A context is a node within a tree that represents deadlines and key/value pairs.
Definition: context.hpp:45
Base class for all HTTP transport implementations.
Definition: transport.hpp:19
HttpTransport(HttpTransport &&other)=default
Constructs HttpTransport by moving another instance of HttpTransport.
HttpTransport & operator=(const HttpTransport &other)=default
Assigns HttpTransport to another instance of HttpTransport.
virtual ~HttpTransport()
Destructs HttpTransport.
Definition: transport.hpp:38
HttpTransport()=default
Constructs a default instance of HttpTransport.
virtual bool HasWebSocketSupport() const
Returns true if the HttpTransport supports WebSockets (the ability to communicate bidirectionally on ...
Definition: transport.hpp:74
virtual std::unique_ptr< RawResponse > Send(Request &request, Context const &context)=0
Send an HTTP request over the wire.
HttpTransport(const HttpTransport &other)=default
Constructs HttpTransport by copying another instance of HttpTransport.
A request message from a client to a server.
Definition: http.hpp:176
Context for canceling long running operations.
HTTP request and response functionality.
Azure SDK abstractions.
Definition: azure_assert.hpp:55