userver: userver/http/parser/http_request_parse_args.hpp Source File
Loading...
Searching...
No Matches
http_request_parse_args.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/http/parser/http_request_parse_args.hpp
4/// @brief Strict URL arguments parsing
5/// @ingroup userver_universal
6
7#include <functional>
8#include <string>
9#include <unordered_map>
10#include <vector>
11
12#include <userver/utils/str_icase.hpp>
13
14USERVER_NAMESPACE_BEGIN
15
16/// @brief Strict HTTP request / URL argument parsing helpers.
17namespace http::parser {
18
19/// Strict URL decoder that throws std::runtime_error on bad input
20std::string UrlDecode(std::string_view url);
21
22void ParseArgs(
23 std::string_view args,
24 std::unordered_map<std::string, std::vector<std::string>, utils::StrCaseHash>& result
25);
26
27using ArgsConsumer = std::function<void(std::string&& key, std::string&& value)>;
28
29void ParseAndConsumeArgs(std::string_view args, ArgsConsumer handler);
30
31} // namespace http::parser
32
33USERVER_NAMESPACE_END