summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nxt_unit_app_test.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/nxt_unit_app_test.c b/src/nxt_unit_app_test.c
index c1bbef4..f595419 100644
--- a/src/nxt_unit_app_test.c
+++ b/src/nxt_unit_app_test.c
@@ -3,6 +3,7 @@
* Copyright (C) NGINX, Inc.
*/
+#define _GNU_SOURCE
#include <nxt_unit.h>
#include <nxt_unit_request.h>
//#include <nxt_clang.h>
@@ -153,7 +154,7 @@ greeting_app_request_handler(nxt_unit_request_info_t *req)
char *p;
ssize_t res;
uint32_t i;
- nxt_unit_buf_t *buf;
+ nxt_unit_buf_t *buf, *buf2;
nxt_unit_field_t *f;
nxt_unit_request_t *r;
@@ -271,6 +272,35 @@ greeting_app_request_handler(nxt_unit_request_info_t *req)
buf->free = p;
rc = nxt_unit_buf_send(buf);
+ if (nxt_slow_path(rc != NXT_UNIT_OK)) {
+ goto fail;
+ }
+
+ buf = nxt_unit_response_buf_alloc(req, strlen("foo"));
+ 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"));
+ if (nxt_slow_path(buf2 == NULL)) {
+ rc = NXT_UNIT_ERROR;
+ goto fail;
+ }
+
+ buf2->free = mempcpy(buf2->free, "barbaz", strlen("barbaz"));
+
+ rc = nxt_unit_buf_send(buf2);
+ if (nxt_slow_path(rc != NXT_UNIT_OK)) {
+ goto fail;
+ }
+
+ rc = nxt_unit_buf_send(buf);
+ if (nxt_slow_path(rc != NXT_UNIT_OK)) {
+ goto fail;
+ }
fail: