diff --git a/docs/c-api/http_server.h/mg_http_send_redirect.md b/docs/c-api/http_server.h/mg_http_send_redirect.md index 206f3e9de7e0f905bc2bbdb5b4441dfd39693dd5..8d7d3b2e2c21c5c91776d810c2f1f8a47f7f6001 100644 --- a/docs/c-api/http_server.h/mg_http_send_redirect.md +++ b/docs/c-api/http_server.h/mg_http_send_redirect.md @@ -13,12 +13,8 @@ Sends a redirect response. new location. If `extra_headers` is not empty, then `extra_headers` are also sent after the reponse line. `extra_headers` must NOT end end with new line. -Example: - - mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *"); -Will result in: +Example: - HTTP/1.1 200 OK\r\n - Access-Control-Allow-Origin: *\r\n + mg_http_send_redirect(nc, 302, mg_mk_str("/login"), mg_mk_str(NULL)); diff --git a/mongoose.h b/mongoose.h index 1726c1cfe16faa05d3311788ade9bfe088c6702e..c4a8ce7593106744db48b2e13fa29991b615584d 100644 --- a/mongoose.h +++ b/mongoose.h @@ -2814,14 +2814,10 @@ void mg_send_response_line(struct mg_connection *nc, int status_code, * new location. * If `extra_headers` is not empty, then `extra_headers` are also sent * after the reponse line. `extra_headers` must NOT end end with new line. - * Example: - * - * mg_send_response_line(nc, 200, "Access-Control-Allow-Origin: *"); * - * Will result in: + * Example: * - * HTTP/1.1 200 OK\r\n - * Access-Control-Allow-Origin: *\r\n + * mg_http_send_redirect(nc, 302, mg_mk_str("/login"), mg_mk_str(NULL)); */ void mg_http_send_redirect(struct mg_connection *nc, int status_code, const struct mg_str location,