NNG_HTTP_RES_ALLOC(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸŽ€ NAME πŸŽ€

nng_http_res_alloc β€” allocate HTTP response structure. Okay bestie, this is the NNG_HTTP_RES_ALLOC(3http) page from the NNG Reference Manual, and we’re about to make a whole HTTP response from scratch. πŸ’…

✨ SYNOPSIS ✨

#include <nng/nng.h>
#include <nng/supplemental/http/http.h>

int nng_http_res_alloc(nng_http_res **resp);

πŸ’– DESCRIPTION πŸ’–

Okay so nng_http_res_alloc() allocates a new HTTP response structure and stores a pointer to it in resp. The response comes out initialized with status code 200 (NNG_HTTP_STATUS_OK), a reason phrase of OK, and HTTP protocol version HTTP/1.1. It’s giving β€œfresh response, ready to slay” energy. ✨

πŸ’‘ Tip: when an error response is needed, consider using nng_http_res_alloc_error() instead. That’s the move, bestie. 🫢

🌈 RETURN VALUES 🌈

This function returns 0 on success, and non-zero otherwise. Periodt.

πŸ’€ ERRORS πŸ’€

  • NNG_ENOMEM β€” Insufficient free memory exists to allocate a message. 😭
  • NNG_ENOTSUP β€” HTTP support not configured. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Go read these next, bestie β€” they’re all part of the same lil’ HTTP/NNG universe:


This page is from the NNG Reference Manual, dated 2026-01-13, and it’s the NNG_HTTP_RES_ALLOC(3http) page. Bye bestie β€” go allocate something cute πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from