## Class request

zeep::http::request

## Synopsis

    // In header: <zeep/http/request.hpp>

    class request {
    public:
      // types
      typedef header param;
      typedef header cookie_directive;

      // construct/copy/destruct
      request(const std::string &, const std::string &,
              std::tuple< int, int > = { 1, 0 }, std::vector< header > && = {},
              std::string && = {});
      request(const request &);
      request & operator=(const request &);

      // friend functions
      std::ostream & operator<<(std::ostream &, const request &);

      // public member functions
      void set_local_endpoint(boost::asio::ip::tcp::socket &);
      std::tuple< std::string, uint16_t > get_local_endpoint() const;
      std::tuple< int, int > get_version() const;
      void set_method(const std::string &);
      const std::string & get_method() const;
      std::string get_uri() const;
      void set_uri(const std::string &);
      std::string get_remote_address() const;
      std::string get_request_line() const;
      const std::string & get_payload() const;
      void set_payload(const std::string &);
      boost::posix_time::ptime get_timestamp() const;
      float get_accept(const char *) const;
      bool keep_alive() const;
      void set_header(const char *, const std::string &);
      auto get_headers() const;
      std::string get_header(const char *) const;
      void remove_header(const char *);
      json::element get_credentials() const;
      void set_credentials(json::element &&);
      std::string get_parameter(const char *) const;
      std::string get_parameter(const char *, const std::string &) const;
      template<typename T,
               typename std::enable_if_t< std::is_floating_point_v< T >, int > = 0>
        T get_parameter(const char *, const T &) const;
      template<typename T,
               typename std::enable_if_t< std::is_integral_v< T > and not std::is_same_v< T, bool >, int > = 0>
        T get_parameter(const char *, const T &) const;
      template<typename T,
               typename std::enable_if_t< std::is_same_v< T, bool >, int > = 0>
        T get_parameter(const char *, const T &) const;
      std::multimap< std::string, std::string > get_parameters() const;
      file_param get_file_parameter(const char *) const;
      std::vector< file_param > get_file_parameters(const char *) const;
      bool has_parameter(const char *) const;
      std::string get_cookie(const char *) const;
      std::string get_cookie(const std::string &) const;
      void set_cookie(const char *, const std::string &);
      std::vector< boost::asio::const_buffer > to_buffers() const;
      std::locale & get_locale() const;
      void set_content(const std::string &, const std::string &);
      void set_header(const std::string &, const std::string &);
      std::tuple< std::string, bool > get_parameter_ex(const char *) const;

      // private member functions
      void set_remote_address(const std::string &);
    };

## Description

request contains the parsed original HTTP request as received by the server.

### `request` public construct/copy/destruct

1.     request(const std::string & method, const std::string & uri,
               std::tuple< int, int > version = { 1, 0 },
               std::vector< header > && headers = {}, std::string && payload = {});

2.     request(const request & req);

3.     request & operator=(const request & rhs);

### `request` friend functions

1.     std::ostream & operator<<(std::ostream & io, const request & req);

   For debugging purposes.

### `request` public member functions

1.     void set_local_endpoint(boost::asio::ip::tcp::socket & socket);

   Fetch the local address from the connected socket.

2.     std::tuple< std::string, uint16_t > get_local_endpoint() const;

3.     std::tuple< int, int > get_version() const;

   Get the HTTP version requested.

4.     void set_method(const std::string & method);

   Set the METHOD type (POST, GET, etc)

5.     const std::string & get_method() const;

   Return the METHOD type (POST, GET, etc)

6.     std::string get_uri() const;

   Return the original URI as requested.

7.     void set_uri(const std::string & uri);

   Set the URI.

8.     std::string get_remote_address() const;

   Get the address of the connecting remote.

9.     std::string get_request_line() const;

   Get the entire request line (convenience method)

10.     const std::string & get_payload() const;

    Return the payload.

11.     void set_payload(const std::string & payload);

    Set the payload.

12.     boost::posix_time::ptime get_timestamp() const;

    Return the time at which this request was received.

13.     float get_accept(const char * type) const;

    Return the value in the Accept header for type.

14.     bool keep_alive() const;

    Check for Connection: keep-alive header.

15.     void set_header(const char * name, const std::string & value);

    Set or replace a named header.

16.     auto get_headers() const;

    Return the list of headers.

17.     std::string get_header(const char * name) const;

    Return the named header.

18.     void remove_header(const char * name);

    Remove this header from the list of headers.

19.     json::element get_credentials() const;

    Get the credentials. This is filled in if the request was validated.

20.     void set_credentials(json::element && credentials);

    Set the credentials for the request.

21.     std::string get_parameter(const char * name) const;

    Return the named parameter.

    Fetch parameters from a request, either from the URL or from the payload in case the request contains a url-encoded or multi-part content-type header

22.     std::string get_parameter(const char * name, const std::string & defaultValue) const;

    Return the value of the parameter named name or the defaultValue if this parameter was not found.

23.     template<typename T,
                 typename std::enable_if_t< std::is_floating_point_v< T >, int > = 0>
          T get_parameter(const char * name, const T & defaultValue) const;

    Return the value of the parameter named name or the defaultValue if this parameter was not found.

24.     template<typename T,
                 typename std::enable_if_t< std::is_integral_v< T > and not std::is_same_v< T, bool >, int > = 0>
          T get_parameter(const char * name, const T & defaultValue) const;

    Return the value of the parameter named name or the defaultValue if this parameter was not found.

25.     template<typename T,
                 typename std::enable_if_t< std::is_same_v< T, bool >, int > = 0>
          T get_parameter(const char * name, const T & defaultValue) const;

    Return the value of the parameter named name or the defaultValue if this parameter was not found.

26.     std::multimap< std::string, std::string > get_parameters() const;

    Return a std::multimap of name/value pairs for all parameters.

27.     file_param get_file_parameter(const char * name) const;

    Return the info for a file parameter with name name.

28.     std::vector< file_param > get_file_parameters(const char * name) const;

    Return the info for all file parameters with name name.

29.     bool has_parameter(const char * name) const;

    Return whether the named parameter is present in the request.

30.     std::string get_cookie(const char * name) const;

    Return the value of HTTP Cookie with name name.

31.     std::string get_cookie(const std::string & name) const;

    Return the value of HTTP Cookie with name name.

32.     void set_cookie(const char * name, const std::string & value);

    Set the value of HTTP Cookie with name name to value.

33.     std::vector< boost::asio::const_buffer > to_buffers() const;

    Return the content of this request in a sequence of const_buffers.

    Can be used in code that sends HTTP requests

34.     std::locale & get_locale() const;

    Return the Accept-Language header value in the request as a std::locale object.

35.     void set_content(const std::string & text, const std::string & contentType);

    suppose we want to construct requests...

36.     void set_header(const std::string & name, const std::string & value);

    set a header

37.     std::tuple< std::string, bool > get_parameter_ex(const char * name) const;

    Return value and flag indicating the existence of a parameter named name.

### `request` private member functions

1.     void set_remote_address(const std::string & address);