NE_GET_CONTENT_TYPE(3)

πŸ“¦
version 0.37.1 Β· 3 versions
, in epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– NE_GET_CONTENT_TYPE πŸ’–

okay bestie, so this is a page from the neon API reference β€” the manual for NE_GET_CONTENT_TYPE(3). yes it's a whole vibe, and yes you're gonna understand it, come on πŸ’…


✨ NAME ✨

ne_get_content_type β€” grab the content type off a response, slay


🌸 SYNOPSIS 🌸

#include <ne_basic.h>

typedef struct {
    const char *type, *subtype;
    const char *charset;
    char *value;
} ne_content_type;

int ne_get_content_type(ne_request *req, ne_content_type *ctype);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. ne_get_content_type goes and fetches the Content-Type header from the response to the request req, and then parses it for you. that's the whole job. it's giving personal assistant energy honestly 🫢

if it works out, every field of the ctype structure gets set β€” and ngl, they are never NULL, not even once. so you can just use them, no vibe check needed.

okay but here's the thing, the part you cannot skip: the value field is yours to free. the caller has to call free on it after use. not me being dramatic, that's literally the rule, don't leak bestie 😭


πŸ’€ RETURN VALUE πŸ’€

ne_get_content_type returns zero when the response had a valid Content-Type header. non-zero means error, periodt.

and on error? the ctype structure is not altered. like, it doesn't get touched, doesn't get halfway filled in, nothing. it stays exactly how you left it. iconic behaviour honestly, very respectful πŸ‘‘


🌈 HISTORY 🌈

back in the day β€” neon 0.36.0 and earlier β€” a default charset value used to get returned for text/xml content-types. but later versions? no default at all, per RFC 7303[1]. so if you were counting on that default, bestie, that era is over πŸ™ˆ


πŸŽ€ SEE ALSO πŸŽ€


Copyright Β© 2001-2026 Joe Orton


⭐ REFERENCES ⭐

  1. RFC 7303 https://www.rfc-editor.org/rfc/rfc7303

okay that's the whole page, you ate it, I'm so proud πŸ’– this was the NE_GET_CONTENT_TYPE(3) page from neon API reference, brought to you by neon 0.37.1, dated 15 March 2026. go free your value field, bestie 🌸✨

πŸ“¦ where this page comes from