Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Add missing `readme_handler` endpoint
Sebastian Martinez committed 9 months ago
commit 8c3a629ecf00f7b03d2d957ac76df60963d36c33
parent e0ae5b5
1 file changed +15 -0
modified crates/test-http-api/src/api.rs
@@ -72,6 +72,7 @@ pub fn router(ctx: Context) -> Router {
            "/activity_by_patch",
            post(activity_patch_handler::<radicle::patch::Action, models::patch::Action>),
        )
+
        .route("/repo_readme", post(readme_handler))
        .route("/repo_tree", post(tree_handler))
        .route("/repo_blob", post(blob_handler))
        .route("/get_diff", post(diff_handler))
@@ -173,6 +174,20 @@ struct DiffBody {
}

#[derive(Serialize, Deserialize)]
+
struct ReadmeBody {
+
    pub rid: identity::RepoId,
+
}
+

+
async fn readme_handler(
+
    State(ctx): State<Context>,
+
    Json(ReadmeBody { rid }): Json<ReadmeBody>,
+
) -> impl IntoResponse {
+
    let readme = ctx.repo_readme(rid, None)?;
+

+
    Ok::<_, Error>(Json(readme))
+
}
+

+
#[derive(Serialize, Deserialize)]
struct TreeBody {
    pub rid: identity::RepoId,
    pub path: PathBuf,