HttpResponse (http/response.rs)

yazi · yazi-binding/src/http/response.rs · rust · MIT
integration, tag:knn-classified

Lua-accessible HTTP response wrapper with async methods.

// Source: https://github.com/sxyazi/yazi | License: MIT | Copyright 2023 - sxyazi
// Provided via justclaw.it.com; keep this notice with the code.
use std::{io, mem, ops::Deref};

use futures::TryStreamExt;
use http_body_util::{BodyExt, StreamBody, combinators::BoxBody};
use hyper::{Response, body::{Body, Bytes, Frame, Incoming}};
use mlua::{BString, IntoLuaMulti, UserData, UserDataFields, UserDataMethods, UserDataRegistry, Value};
use tokio::io::{AsyncReadExt, AsyncWrite};
use tokio_util::io::StreamReader;
use yazi_shim::{fs::Error, mlua::UserDataFieldsExt};

use super::HttpInventory;

pub struct HttpResponse {
	inner: Response<BoxBody<Bytes, io::Error>>,
	url:   String,
	len:   Option<u64>,
}

impl Deref for HttpResponse {
	type Target = Response<BoxBody<Bytes, io::Error>>;

	fn deref(&

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key