* update tests

This commit is contained in:
hagen 2016-05-24 00:00:00 +00:00
parent 2ce61402bb
commit b68f06ca83
4 changed files with 22 additions and 4 deletions

View file

@ -3,11 +3,12 @@
using namespace i2p::http;
int main(int argc, char *argv[]) {
int main() {
HTTPRes *res;
int ret = 0, len = 0;
const char *buf;
/* test: parsing valid response without body */
buf =
"HTTP/1.1 304 Not Modified\r\n"
"Date: Thu, 14 Apr 2016 00:00:00 GMT\r\n"
@ -31,6 +32,18 @@ int main(int argc, char *argv[]) {
assert(res->length() == 536);
delete res;
/* test: building request */
buf =
"HTTP/1.0 304 Not Modified\r\n"
"Content-Length: 0\r\n"
"\r\n";
res = new HTTPRes;
res->version = "HTTP/1.0";
res->code = 304;
res->status = "Not Modified";
res->add_header("Content-Length", "0");
assert(res->to_string() == buf);
return 0;
}