nng_http_req_set_uri(3http)

# nng_http_req_set_uri(3http) Manual Page

## NAME

nng_http_req_set_uri - set HTTP request URI

## 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

The `nng_http_req_set_uri()` sets the Request-URI associated with the request req to uri. The uri should contain precisely the string that will be sent to the HTTP server in the request, including any query information or fragment.

A local copy of the uri is made in the request req.

| No validation or canonicalization of the uri is performed.

| The `nng_url_parse()` function can be used to perform validation and canonicalization. The `u_requri` member will contain a suitable value that can be used with this function.

## RETURN VALUES

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

## ERRORS

`NNG_ENOMEM` | Insufficient memory to perform the operation.
`NNG_ENOTSUP` | No support for HTTP in the library.

## SEE ALSO

nng_http_req_alloc(3http), nng_http_req_get_uri(3http), nng_url_parse(3), nng(7)