refactor: reorder pub fn before inner impl

This commit is contained in:
Joonas Koivunen 2020-07-08 19:42:47 +03:00
parent 6f2bf990cb
commit 7637874087

View File

@ -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>(
ipfs: Ipfs<T>,
query: PutQuery,
@ -81,17 +92,6 @@ async fn put_query<T: IpfsTypes>(
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
/// path and resolves it to the last block (the cid), and to the path inside the final block
/// (rempath).