pub unsafe extern "C" fn httpd_resp_set_status(
    r: *mut httpd_req_t,
    status: *const c_char
) -> esp_err_t
Expand description

@brief API to set the HTTP status code

This API sets the status of the HTTP response to the value specified. By default, the ‘200 OK’ response is sent as the response.

@note

  • This API is supposed to be called only from the context of a URI handler where httpd_req_t* request pointer is valid.
  • This API only sets the status to this value. The status isn’t sent out until any of the send APIs is executed.
  • Make sure that the lifetime of the status string is valid till send function is called.

@param[in] r The request being responded to @param[in] status The HTTP status code of this response

@return

  • ESP_OK : On success
  • ESP_ERR_INVALID_ARG : Null arguments
  • ESP_ERR_HTTPD_INVALID_REQ : Invalid request pointer