NNG_HTTP_RES_GET_HEADER(3http)
π 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:
HostorhOStβ 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
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms