refactor: reorder pub fn before inner impl
This commit is contained in:
parent
6f2bf990cb
commit
7637874087
@ -30,6 +30,17 @@ impl Default for InputEncoding {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn put<T: IpfsTypes>(
|
||||||
|
ipfs: &Ipfs<T>,
|
||||||
|
) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
||||||
|
path!("dag" / "put")
|
||||||
|
.and(with_ipfs(ipfs))
|
||||||
|
.and(query::<PutQuery>())
|
||||||
|
.and(warp::header::<Mime>("content-type")) // TODO: rejects if missing
|
||||||
|
.and(warp::body::stream())
|
||||||
|
.and_then(put_query)
|
||||||
|
}
|
||||||
|
|
||||||
async fn put_query<T: IpfsTypes>(
|
async fn put_query<T: IpfsTypes>(
|
||||||
ipfs: Ipfs<T>,
|
ipfs: Ipfs<T>,
|
||||||
query: PutQuery,
|
query: PutQuery,
|
||||||
@ -81,17 +92,6 @@ async fn put_query<T: IpfsTypes>(
|
|||||||
Ok(reply::json(&reply))
|
Ok(reply::json(&reply))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn put<T: IpfsTypes>(
|
|
||||||
ipfs: &Ipfs<T>,
|
|
||||||
) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
|
||||||
path!("dag" / "put")
|
|
||||||
.and(with_ipfs(ipfs))
|
|
||||||
.and(query::<PutQuery>())
|
|
||||||
.and(warp::header::<Mime>("content-type")) // TODO: rejects if missing
|
|
||||||
.and(warp::body::stream())
|
|
||||||
.and_then(put_query)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Per https://docs-beta.ipfs.io/reference/http/api/#api-v0-block-resolve this endpoint takes in a
|
/// Per https://docs-beta.ipfs.io/reference/http/api/#api-v0-block-resolve this endpoint takes in a
|
||||||
/// path and resolves it to the last block (the cid), and to the path inside the final block
|
/// path and resolves it to the last block (the cid), and to the path inside the final block
|
||||||
/// (rempath).
|
/// (rempath).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user