summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-05-20 20:45:42 +0200
committerAlejandro Colomar <alx@kernel.org>2023-05-20 20:46:06 +0200
commitec0cfb83e78ec0494fe7be86292aabdfda390923 (patch)
tree53b61080f1ceb18708af089391ed28cd2773200b
parentc3b6231eca2f7ff9ddf2758922953ef2e97947e1 (diff)
nxt_unit_app_test.c: Use the example from nxt_response_buf_alloc(3)
The text, and the order in which the calls are made, makes it more clear that the buffers can be sent in any order. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--src/nxt_unit_app_test.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nxt_unit_app_test.c b/src/nxt_unit_app_test.c
index f595419..98e6875 100644
--- a/src/nxt_unit_app_test.c
+++ b/src/nxt_unit_app_test.c
@@ -276,21 +276,22 @@ greeting_app_request_handler(nxt_unit_request_info_t *req)
goto fail;
}
- buf = nxt_unit_response_buf_alloc(req, strlen("foo"));
+ buf = nxt_unit_response_buf_alloc(req, strlen("Some extra contents.\n"));
if (nxt_slow_path(buf == NULL)) {
rc = NXT_UNIT_ERROR;
goto fail;
}
- buf->free = mempcpy(buf->free, "foo", strlen("foo"));
-
- buf2 = nxt_unit_response_buf_alloc(req, strlen("barbaz"));
+ buf2 = nxt_unit_response_buf_alloc(req, strlen("But send this first.\n"));
if (nxt_slow_path(buf2 == NULL)) {
rc = NXT_UNIT_ERROR;
goto fail;
}
- buf2->free = mempcpy(buf2->free, "barbaz", strlen("barbaz"));
+ buf2->free = mempcpy(buf2->free, "But send this first.\n",
+ strlen("But send this first.\n"));
+ buf->free = mempcpy(buf->free, "Some extra contents.\n",
+ strlen("Some extra contents.\n"));
rc = nxt_unit_buf_send(buf2);
if (nxt_slow_path(rc != NXT_UNIT_OK)) {