Repos
C++
564 B18 lines Opens in site
Directory
Raw
Download
#pragma once
// Spec: SPEC.md FR-NET-02. Percent encoding for query values and path segments.
#include <string>
#include <utility>
#include <vector>
namespace dp {
class UrlCodec {
public:
// RFC 3986 unreserved characters stay, everything else becomes %XX (UTF-8 bytes).
static std::string encode(const std::string& text);
static std::string buildQuery(const std::vector<std::pair<std::string, std::string>>& params);
// ws:// and wss:// from http:// and https://.
static std::string toWebSocketScheme(const std::string& url);
};
} // namespace dp