Add method check for test suite

* tests/libtest.h: Add expected_method to wget_test_url_t
* tests/libtest.c (_answer_to_connection): Check method against expected_method
This commit is contained in:
Tim Rühsen
2019-10-27 19:19:55 +01:00
parent 33308b6b88
commit fc62c2f4b9
2 changed files with 9 additions and 0 deletions

View File

@ -435,6 +435,13 @@ static int _answer_to_connection(
// check request headers
bool bad_request = false;
if (request_url->expected_method && strcmp(method, request_url->expected_method)) {
wget_debug_printf("%s: Expected request method '%s', but got '%s'\n",
__func__, request_url->expected_method, method);
bad_request = true;
break;
}
for (const char **header = request_url->expected_req_headers; *header; header++) {
const char *header_value = strchr(*header, ':');
const char *header_key = wget_strmemdup(*header, header_value - *header);

View File

@ -128,6 +128,8 @@ typedef struct {
expected_req_headers[10];
const char *
unexpected_req_headers[10];
const char *
expected_method;
int64_t
modified;