NNG_HTTP_HANDLER_SET_METHOD(3http)
π NAME π
okay so this is nng_http_handler_set_method β it sets the HTTP handler method, and this page is from the NNG Reference Manual. Itβs literally the βwhich HTTP method does this handler answer to?β function. π
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_handler_set_method(nng_http_handler *handler, const char *method);
πΈ DESCRIPTION πΈ
The nng_http_handler_set_method() function sets the method that the handler will be called for, such as "GET" or "POST". By default, the "GET" method is handled. slay.
Hereβs the parameter vibe check:
handlerβ thenng_http_handler *argument.methodβ aconst char *for the method name. IfmethodisNULL, then the request method is not examined, and the handler will be executed regardless of the method. no cap.
π¨ Note β The server will automatically call"GET"handlers if the client sends a"HEAD"request, and will suppress HTTP body data in the responses sent for such requests.
π¨ Note β No validation of the method is performed, but HTTP specifications insist that the actual method sent over the wire be capitalized. so capitalize it, bestie.
The handler may always examine the actual method used using the nng_http_req_get_method() function. iykyk.
π RETURN VALUES π
It returns 0 on success, and non-zero otherwise. periodt.
π ERRORS π
NNG_ENOMEMβ Insufficient free memory exists.NNG_ENOTSUPβ No support for HTTP in the library.
π¦ SEE ALSO π¦
nng_http_handler_alloc(3http)nng_http_server_add_handler(3http)nng_http_req_get_method(3http)nng(7)
π thatβs the whole page, bestie β source/version: NNG Reference Manual, date: 2026-01-13. byeeee π«Άβ¨
π¦ 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