Function esp_idf_hal::sys::httpd_resp_send_err

source ยท
pub unsafe extern "C" fn httpd_resp_send_err(
    req: *mut httpd_req,
    error: u32,
    msg: *const i8,
) -> i32
Expand description

@brief For sending out error code in response to HTTP request.

@note

  • This API is supposed to be called only from the context of a URI handler where httpd_req_t* request pointer is valid.
  • Once this API is called, all request headers are purged, so request headers need be copied into separate buffers if they are required later.
  • If you wish to send additional data in the body of the response, please use the lower-level functions directly.

@param[in] req Pointer to the HTTP request for which the response needs to be sent @param[in] error Error type to send @param[in] msg Error message string (pass NULL for default message)

@return

  • ESP_OK : On successfully sending the response packet
  • ESP_ERR_INVALID_ARG : Null arguments
  • ESP_ERR_HTTPD_RESP_SEND : Error in raw send
  • ESP_ERR_HTTPD_INVALID_REQ : Invalid request pointer