From da5d9dc03b14b4d0f1ce0ce3ff093f387e148706 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Mon, 28 Aug 2023 16:11:15 +0100 Subject: libunit-wasm: Remove the idx argument from luw_http_add_header() This was used to specify the index of the response header being added, starting at 0 and incrementing by one for each header. Instead of having the programmer specify this, track it internally. We add an extra check in luw_http_add_header() to make sure we aren't trying to add more headers than we said with luw_http_init_headers(), if we are, simply return. This updates the API-C.md and the various examples and 'rusty' API wrapper. Suggested-by: Liam Crilly Signed-off-by: Andrew Clayton --- examples/c/luw-upload-reflector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/c/luw-upload-reflector.c') diff --git a/examples/c/luw-upload-reflector.c b/examples/c/luw-upload-reflector.c index 95bc514..5abce9f 100644 --- a/examples/c/luw-upload-reflector.c +++ b/examples/c/luw-upload-reflector.c @@ -57,8 +57,8 @@ static int upload_reflector(luw_ctx_t *ctx) luw_get_http_content_len(ctx)); luw_http_init_headers(ctx, 2, 0); - luw_http_add_header(ctx, 0, "Content-Type", ct ? ct : defct); - luw_http_add_header(ctx, 1, "Content-Length", clen); + luw_http_add_header(ctx, "Content-Type", ct ? ct : defct); + luw_http_add_header(ctx, "Content-Length", clen); luw_http_send_headers(ctx); } -- cgit