pub async fn write_response(
session: &mut Session,
response: Response<Full<Bytes>>,
keepalive_secs: Option<u64>,
) -> Result<(), Box<Error>>Expand description
Write an HTTP response to a Pingora session
Handles the conversion from http::Response<Full<Bytes>> to Pingora’s
format and writes it to the session.
§Arguments
session- The Pingora session to write toresponse- The HTTP response to writekeepalive_secs- Keepalive timeout in seconds (None = disable keepalive)
§Returns
Returns Ok(()) on success or an error if writing fails.
§Example
ⓘ
let response = Response::builder()
.status(200)
.body(Full::new(Bytes::from("OK")))?;
write_response(session, response, Some(60)).await?;