blob: d578f69f241139cda4ea03dbed92dd05f7df353f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "parsed_request.h"
#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(THttpParse) {
Y_UNIT_TEST(TestParse) {
TParsedHttpFull h("GET /yandsearch?text=nokia HTTP/1.1");
UNIT_ASSERT_EQUAL(h.Method, "GET");
UNIT_ASSERT_EQUAL(h.Request, "/yandsearch?text=nokia");
UNIT_ASSERT_EQUAL(h.Proto, "HTTP/1.1");
UNIT_ASSERT_EQUAL(h.Path, "/yandsearch");
UNIT_ASSERT_EQUAL(h.Cgi, "text=nokia");
}
Y_UNIT_TEST(TestError) {
bool wasError = false;
try {
TParsedHttpFull("GET /yandsearch?text=nokiaHTTP/1.1");
} catch (...) {
wasError = true;
}
UNIT_ASSERT(wasError);
}
}
|