From ec0cfb83e78ec0494fe7be86292aabdfda390923 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 20 May 2023 20:45:42 +0200 Subject: 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 --- src/nxt_unit_app_test.c | 11 ++++++----- 1 file 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)) { -- cgit v1.2.3