#include <userver/utest/http_server_mock.hpp>
Toy HTTP server for testing; for raw TCP or TLS testing use utest::SimpleServer.
In constructor opens specified ports in localhost address and listens on them. On each HTTP request calls user callback.
Definition at line 27 of file http_server_mock.hpp.
Classes | |
struct | HttpRequest |
Structure with HTTP request that is passed to the HttpHandler callback. More... | |
struct | HttpResponse |
Structure with HTTP response to return from the HttpHandler callback. More... | |
Public Types | |
using | HttpHandler = std::function<HttpResponse(const HttpRequest&)> |
Callback that is invoked on each HTTP request. | |
Public Member Functions | |
HttpServerMock (HttpHandler http_handler, SimpleServer::Protocol protocol=SimpleServer::kTcpIpV4) | |
std::string | GetBaseUrl () const |
Returns URL to the server, for example 'http://127.0.0.1:8080'. | |
std::uint64_t | GetConnectionsOpenedCount () const |
using utest::HttpServerMock::HttpHandler = std::function<HttpResponse(const HttpRequest&)> |
Callback that is invoked on each HTTP request.
Definition at line 47 of file http_server_mock.hpp.
|
friend |
Definition at line 57 of file http_server_mock.hpp.