Skip to content

Commit

Permalink
moss/request: Add a todo for file:// URIs (indices, etc)
Browse files Browse the repository at this point in the history
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
  • Loading branch information
ikeycode committed Oct 18, 2023
1 parent 034445f commit c19d75d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions moss/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ static CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {

/// Fetch a resource at the provided [`Url`] and stream it's response bytes
pub async fn get(url: Url) -> Result<impl Stream<Item = Result<Bytes>>> {
let response = CLIENT.get(url).send().await?;
match url.scheme() {
"file" => todo!(),
_ => {
let response = CLIENT.get(url).send().await?;

response
.error_for_status()
.map(reqwest::Response::bytes_stream)
response
.error_for_status()
.map(reqwest::Response::bytes_stream)
}
}
}

0 comments on commit c19d75d

Please sign in to comment.