NNG_HTTP_REQ_SET_METHOD(3http)
π nng_http_req_set_method β set HTTP request method
okay bestie, welcome to the 3http corner of the NNG Reference Manual β¨ this one's short and sweet and honestly? iconic behavior. it's the little function that tells your HTTP request who it is β like a vibe check but for methods π
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_req_set_method(nng_http_req *req, const char *method);
π¦ DESCRIPTION π¦
so like. nng_http_req_set_method() sets the HTTP method associated with the request req to method. that's it, that's the whole thing π«Ά
the method has to be a string, mmkay β stuff like "GET" or "POST" β and the HTTP specifications indicate that it must be upper case. lowercase is not the moment, i fear π
for newly allocated requests, the default value method is "GET" β which honestly makes sense, it's giving "i'm just here to read the timeline" energy.
also important: a local copy of the method is made in the request req π so you don't have to keep your string alive forever, no cap.
π RETURN VALUES π
this function returns 0 on success, and non-zero otherwise. slay π
π₯ ERRORS π₯
NNG_ENOMEMβ insufficient memory to perform the operation π the malloc said no and honestly same.NNG_ENOTSUPβ no support for HTTP in the library π like, this build of the library just doesn't do HTTP, sorry bestie.
π SEE ALSO π
and that's the whole page, bestie, we ate and left no crumbs πβ¨ go forth and set your methods, uppercase only, iykyk π
sign-off wishes from the NNG Reference Manual (the3httpone, main character energy fr fr), dated2026-01-13β bye pookie π§ββοΈπΈ
π¦ 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