NNG_HTTP_RES_GET_HEADER(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… NNG_HTTP_RES_GET_HEADER πŸ’…

okay so bestie, welcome to the 3http section of the NNG Reference Manual β€” yes that's the manual name, and yes it's giving "I live in the http corner of the docs" ✨. This one is a tiny little function but it's lowkey iconic, so let's get into it.


🌸 NAME 🌸

nng_http_res_get_header β€” return HTTP response header πŸŽ€


✨ SYNOPSIS ✨

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

const char *nng_http_res_get_header(nng_http_res *res, const char *key);

Like, copy it exactly, no cap. Two includes, one function, one const char * return. Periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

So nng_http_res_get_header() goes looking for an HTTP header key inside the response res, and if it finds it, it hands you back the associated value. If it doesn't find it? You get NULL. That's it. That's the whole vibe check. πŸ’€

Now here's the part where people mess up, so listen up 🫢 β€” the value of key is case insensitive, and it should not include the final colon in an HTTP header. Like, fr fr:

  • Host or hOSt β€” equivalent, both slay, both work βœ…
  • Host: β€” nope, not finding anything, this one ate nothing πŸ™ˆ

So don't be adding that colon, bestie, it's not the moment. πŸ’…


πŸ”₯ RETURN VALUES πŸ”₯

The HTTP header value for key, if it exists β€” or NULL otherwise. Simple as that. 🌈


πŸ’œ ERRORS πŸ’œ

None. Literally none. Zero. Not a single error to worry about, main character energy only. πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

Go read the whole squad, iykyk. πŸ’–


okay bye bestie, that's the page πŸ¦‹ β€” this little gem is from the NNG Reference Manual, dated 2026-01-13, and it's the NNG_HTTP_...GET_HEADER(3http) page. go get those headers, you're gonna do amazing β­πŸ’…πŸ“

πŸ“¦ where this page comes from