HTTP, cache, cookie, and request sandbox helpers for crater browser
Dependencies
mizchi/crater-browser-http does not have a README file
pub(open) trait HttpCacheBackend {
lookup(Self, String) -> CacheEntry?
store(Self, CacheEntry) -> Unit
remove(Self, String) -> Unit
clear(Self) -> Unit
}pub suberror HttpError {
NetworkError(String)
InvalidUrl(String)
TimeoutError
CorsError(String)
SandboxError(String)
}pub(all) struct CacheDirectives {
max_age : Int?
no_cache : Bool
no_store : Bool
must_revalidate : Bool
public_ : Bool
private_ : Bool
immutable : Bool
} derive(Debug)impl Show for CacheDirectivespub(all) struct CacheEntry {
url : String
status : Int
headers : Map[String, String]
body : String
etag : String?
last_modified : String?
directives : CacheDirectives
stored_at : Double
} derive(Debug)pub(all) struct FetchOptions {
http_method : String
headers : Map[String, String]
body : String
timeout_ms : Int
mode : RequestMode
credentials : CredentialsMode
origin : String
sandbox : RequestSandbox
}impl HttpCacheBackend for MemoryCacheBackendpub(all) struct ParsedCookie {
name : String
value : String
domain : String
path : String
secure : Bool
http_only : Bool
same_site : String
max_age : Int?
expires : String?
} derive(Debug)impl Show for ParsedCookiefn[CacheBackend : HttpCacheBackend] cached_fetch(url~ : String, options~ : FetchOptions, cache~ : CacheBackend, fetcher~ : (String, FetchOptions) -> HttpResponse raise HttpError) -> HttpResponse raise HttpErrorasync fn[CacheBackend : HttpCacheBackend] cached_fetch_async(url~ : String, options~ : FetchOptions, cache~ : CacheBackend, fetcher~ : async (String, FetchOptions) -> HttpResponse raise HttpError) -> HttpResponse raise HttpErrorfn is_cacheable_status(status : Int) -> Boolfn now_seconds() -> Doublefn parse_set_cookie(header : String, request_domain : String, request_path : String) -> ParsedCookie?HTTP, cache, cookie, and request sandbox helpers for crater browser
Dependencies