summaryrefslogtreecommitdiffhomepage
path: root/examples/rust/echo-request
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-08-30 01:55:26 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-08-30 01:55:26 +0100
commitd62b8e93fdaf62a36c36437f987485f7be36e52f (patch)
treef4566b4f65ce3e67fe6d5397ad2ec87756f2a8fe /examples/rust/echo-request
parent71ba509e6d662e1e8e703a7e1e609e1b1f8eb929 (diff)
downloadunit-wasm-d62b8e93fdaf62a36c36437f987485f7be36e52f.tar.gz
unit-wasm-d62b8e93fdaf62a36c36437f987485f7be36e52f.tar.bz2
examples/rust: Update for new API additions
Update the echo-request and upload-reflector examples for the new uwr_http_add_header_content_type() and uwr_http_add_header_content_len() functions. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'examples/rust/echo-request')
-rw-r--r--examples/rust/echo-request/src/lib.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/examples/rust/echo-request/src/lib.rs b/examples/rust/echo-request/src/lib.rs
index d65cfb0..943c514 100644
--- a/examples/rust/echo-request/src/lib.rs
+++ b/examples/rust/echo-request/src/lib.rs
@@ -102,12 +102,8 @@ pub extern "C" fn uwr_request_handler(addr: *mut u8) -> i32 {
// storing the response headers at the beginning of our shared
// memory at offset 0.
uwr_http_init_headers(ctx, 2, 0);
- uwr_http_add_header(ctx, "Content-Type", "text/plain");
- uwr_http_add_header(
- ctx,
- "Content-Length",
- &format!("{}", uwr_get_response_data_size(ctx)),
- );
+ uwr_http_add_header_content_type(ctx, "text/plain");
+ uwr_http_add_header_content_len(ctx);
// This calls nxt_wasm_send_headers() in Unit
uwr_http_send_headers(ctx);