diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-01-12 10:25:56 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-01-12 10:52:03 -0800 |
| commit | e5721f6b4dd7e4084a14b6f2f38bfb3672796ac9 (patch) | |
| tree | 71c9f6c8e4b0a260efd6209c55cc20b1f88275db /src/testing/nuts.h | |
| parent | 169166a0ef4fad56860c40ba2eda23f27b8a4cb1 (diff) | |
| download | nng-e5721f6b4dd7e4084a14b6f2f38bfb3672796ac9.tar.gz nng-e5721f6b4dd7e4084a14b6f2f38bfb3672796ac9.tar.bz2 nng-e5721f6b4dd7e4084a14b6f2f38bfb3672796ac9.zip | |
http: server error handling improvements and tests
We want to consume the request properly on an error, so that
we can give a reasonable response. We were prematurely closing
the connection for certain failure modes. We still have to fix
overly long URIs and headers, but thats next!
Diffstat (limited to 'src/testing/nuts.h')
| -rw-r--r-- | src/testing/nuts.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/testing/nuts.h b/src/testing/nuts.h index ac502ff8..290af723 100644 --- a/src/testing/nuts.h +++ b/src/testing/nuts.h @@ -214,7 +214,7 @@ extern const char *nuts_ecdsa_client_crt; nng_strerror(result_), result_); \ } while (0) -// NUTS_ERROR tests for a specific NNG error code. +// NUTS_FAIL tests for a specific NNG error code. #define NUTS_FAIL(cond, expect) \ do { \ int result_ = (cond); \ @@ -325,4 +325,12 @@ extern const char *nuts_ecdsa_client_crt; }; #endif +#define NUTS_HTTP_STATUS(conn, expect) \ + do { \ + TEST_CHECK(nng_http_get_status(conn) == (expect)); \ + TEST_MSG("HTTP status: expected %d (%s) got %d (%s)", expect, \ + #expect, nng_http_get_status(conn), \ + nng_http_get_reason(conn)); \ + } while (0) + #endif // NNG_TEST_NUTS_H |
