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

@brief API to set the HTTP content type

This API sets the ‘Content Type’ field of the response. The default content type is ‘text/html’.

@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 content type to this value. The type isn’t sent out until any of the send APIs is executed.
  • Make sure that the lifetime of the type string is valid till send function is called.

@param[in] r The request being responded to @param[in] type The Content Type of the response

@return

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