Session Request working

This commit is contained in:
Florian Märkl 2018-11-16 21:39:18 +01:00
commit 2fa6ad8b21
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
11 changed files with 263 additions and 33 deletions

View file

@ -18,10 +18,12 @@
#include <munit.h>
#include <chiaki/http.h>
#include <stdio.h>
static const char *response =
"HTTP/1.1 200 OK\r\n"
"Content-type: text/html, text, plain\r\n"
"Ultimate Ability: Gamer\r\n"
"\r\n";
static void *test_http_response_parse_setup(const MunitParameter params[], void *user)
@ -41,6 +43,21 @@ static MunitResult test_http_response_parse(const MunitParameter params[], void
ChiakiErrorCode err = chiaki_http_response_parse(&parsed_response, buf, strlen(buf));
munit_assert_int(err, ==, CHIAKI_ERR_SUCCESS);
munit_assert_int(parsed_response.code, ==, 200);
ChiakiHttpHeader *header = parsed_response.headers;
munit_assert_ptr_not_null(header);
munit_assert_string_equal(header->key, "Ultimate Ability");
munit_assert_string_equal(header->value, "Gamer");
header = header->next;
munit_assert_ptr_not_null(header);
munit_assert_string_equal(header->key, "Content-type");
munit_assert_string_equal(header->value, "text/html, text, plain");
header = header->next;
munit_assert_ptr_null(header);
chiaki_http_response_fini(&parsed_response);
return MUNIT_OK;
}