NNG_HTTP_REQ_SET_HEADER(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… nng_http_req_set_header(3http) β€” set HTTP request header πŸ’…

okay bestie, welcome to the NNG Reference Manual β€” this page is all about setting one HTTP request header, and it is lowkey iconic for how much it does with so little. πŸŽ€


🌸 NAME 🌸

nng_http_req_set_header β€” set HTTP request header ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <nng/nng.h>
#include <nng/supplemental/http/http.h>

int nng_http_req_set_header(nng_http_req *req, const char *key,
    const char *val);

✨ DESCRIPTION ✨

So nng_http_req_set_header() sets the HTTP header for the request req and the key to the val. The key and val are copied. Any previous header with the same key is replaced. slay, it's giving overwrite energy πŸ’…

Tip β€” See nng_http_req_add_header() to add additional headers with the same key without replacing them. iykyk 🫢

The value of key is case insensitive, and should not include the final colon in an HTTP header. For example, specifying Host or hOSt are equivalent, whereas the value Host: is not a legal header key. no cap, that colon is not invited to the function πŸ’€


πŸ”₯ RETURN VALUES πŸ”₯

This function returns 0 on success, and non-zero otherwise. so: 0 = slay, anything else = bestie check the vibes 😭


🌈 ERRORS 🌈

  • NNG_ENOMEM β€” Insufficient memory to perform the operation. πŸ“
  • NNG_ENOTSUP β€” No support for HTTP in the library. πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

go peek at these besties next, fr fr:


okay that's the whole page, bestie β€” from the NNG Reference Manual, dated 2026-01-13, under the page title NNG_HTTP_...SET_HEADER(3http) πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from