wormhole/test/request_test.cpp
nekobit 2a06ffa86c Split CMake components to libraries, import OpenSSL
FossilOrigin-Name: fc69966ec9877debf721b13592fe218090d57c92f967c4c0ec9f95f36aedfff5
2022-10-11 00:22:45 +00:00

20 lines
758 B
C++

#include <cassert>
#include <iostream>
#include "http/request.h"
using namespace HTTP;
int main()
{
Request request1{Request::Type::GET, "/test/:123/fast"};
assert(( request1 == Request{Request::Type::GET, "/test/:123/fast"} ));
assert(( request1 != Request{Request::Type::POST, "/test/:123/fast"} ));
assert(( request1 != Request{Request::Type::GET, "/tes8203508/fast"} ));
Request request1_match1{Request::Type::GET, "/test/the_data123/fast"};
Request request1_match2{Request::Type::GET, "/test/notthedata/fast"};
assert(( (*request1.match_get_args(request1_match1))[0] == "the_data" ));
assert(( request1.match_get_args(request1_match2) == std::nullopt ));
return 0;
}