mirror of
https://gitlab.com/gnuwget/wget2.git
synced 2026-02-01 14:41:08 +00:00
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:
@ -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);
|
||||
|
||||
@ -128,6 +128,8 @@ typedef struct {
|
||||
expected_req_headers[10];
|
||||
const char *
|
||||
unexpected_req_headers[10];
|
||||
const char *
|
||||
expected_method;
|
||||
int64_t
|
||||
modified;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user