summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Orton <joe@manyfish.uk>2020-06-16 21:54:43 +0100
committerJoe Orton <jorton@apache.org>2020-06-18 08:01:27 +0100
commitd47a40a52dfd601a9eb967ac958776f032abe7e7 (patch)
treed295f02ca053548ca5e689992ddc3887e3c46c28
parentbc5b8ebece80a24ef736aa09d80d12d169211a47 (diff)
downloadneon-git-d47a40a52dfd601a9eb967ac958776f032abe7e7.tar.gz
* test/utils.c (any_2xx_response): Use the X-Neon-Context:
header to include any descriptive failure message from the server if made available via error_response().
-rw-r--r--test/utils.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/utils.c b/test/utils.c
index c2b7207..9d8e54b 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -104,9 +104,18 @@ int any_2xx_request(ne_session *sess, const char *uri)
ne_request *req = ne_request_create(sess, "GET", uri);
int ret = ne_request_dispatch(req);
int klass = ne_get_status(req)->klass;
+ const char *context = ne_get_response_header(req, "X-Neon-Context");
+ if (ret != NE_OK || klass != 2) {
+ if (context)
+ t_context("request failed, server error: %s", context);
+ else
+ t_context("request failed: %s", ne_get_error(sess));
+ ret = FAIL;
+ }
+ else {
+ ret = OK;
+ }
ne_request_destroy(req);
- ONV(ret != NE_OK || klass != 2,
- ("request failed: %s", ne_get_error(sess)));
return ret;
}