wormhole/test/request_test.cpp
nekobit f57708a0c9 Scrubbing... We're back
FossilOrigin-Name: 4fde441d7ec8011e697a949b4e24b9e2f22abdfe44732e55411bd927abd62979
2023-04-10 13:58:40 +00:00

20 lines
698 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;
}