NNG_HTTP_HANDLER_SET_METHOD(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… 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 β€” the nng_http_handler * argument.
  • method β€” a const char * for the method name. If method is NULL, 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 πŸ¦‹


πŸ’– that’s the whole page, bestie β€” source/version: NNG Reference Manual, date: 2026-01-13. byeeee 🫢✨

πŸ“¦ where this page comes from