NNG_HTTP_REQ_SET_URI(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’– NAME πŸ’–

nng_http_req_set_uri β€” so you wanna set the URI on an HTTP request? bestie, this is literally the function for that ✨


🌸 SYNOPSIS 🌸

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

int nng_http_req_set_uri(nng_http_req *req, const char *uri);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so nng_http_req_set_uri() sets the Request-URI that's chillin' on the request req, and it sets it to uri. no cap, that's the whole vibe 🫢

and like β€” the uri you pass in should contain precisely the string that's gonna get sent to the HTTP server in the request. including any query information or fragment. all of it, every last crumb, don't leave anything out πŸ’…

the function makes a local copy of the uri inside the request req, so your string is safely tucked away πŸŽ€

⚠️ note ⚠️ β€” no validation or canonicalization of the uri is performed. like, zero. none. it takes you at your word, so maybe double-check yourself before you wreck yourself πŸ™ˆ
πŸ’‘ tip πŸ’‘ β€” you can get validation and canonicalization if you want it! nng_url_parse() is right there for you, and the u_requri member will contain a suitable value that you can absolutely hand off to this function. slay πŸ”₯

⭐ RETURN VALUES ⭐

this function returns 0 on success, and non-zero otherwise. simple as that, bestie πŸ’œ


πŸŽ€ ERRORS πŸŽ€

  • NNG_ENOMEM β€” insufficient memory to perform the operation 😭 like your computer said "nah, not today"
  • NNG_ENOTSUP β€” no support for HTTP in the library πŸ’€ the library literally doesn't do HTTP, sorry girl

🌈 SEE ALSO 🌈


iykyk, this page is from the NNG Reference Manual, dated 2026-01-13 β€” go off and set those URIs, main character πŸ’…πŸ‘‘

πŸ“¦ where this page comes from