net-cpp ..
C++11 library for networking purposes
core::net Namespace Reference

Namespaces

namespace  http
 

Classes

class  Error
 
struct  Uri
 The Uri class encapsulates the components of a URI. More...
 

Functions

CORE_NET_DLL_PUBLIC Uri make_uri (const Uri::Host &host, const Uri::Path &path=Uri::Path(), const Uri::QueryParameters &query_parameters=Uri::QueryParameters())
 Build a URI from its components.
 

Function Documentation

◆ make_uri()

CORE_NET_DLL_PUBLIC Uri core::net::make_uri ( const Uri::Host & host,
const Uri::Path & path = Uri::Path(),
const Uri::QueryParameters & query_parameters = Uri::QueryParameters() )

Build a URI from its components.

e.g.

std::string query = "banana";
auto uri = core::net::make_uri("https://api.mydomain.com", {"api", "v3", "search"}, {{"query", query}});
CORE_NET_DLL_PUBLIC Uri make_uri(const Uri::Host &host, const Uri::Path &path=Uri::Path(), const Uri::QueryParameters &query_parameters=Uri::QueryParameters())
Build a URI from its components.

When converted to a std::string with core::net::http::client::uri_to_string() the endpoint and parameters will be URL-escaped.