Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
httpd: Only return cache header for activity endpoint on 200 responses
Merged did:key:z6MkkfM3...sVz5 opened 2 years ago

Also fix test_profile test adding the worker config

2 files changed +8 -2 04a4aa06 3aca2a11
modified radicle-httpd/src/api/v1/profile.rs
@@ -111,6 +111,7 @@ mod routes {
                      "outbound": 16
                    }
                  },
+
                  "workers": 8,
                  "policy": "block",
                  "scope": "all"
                }
modified radicle-httpd/src/api/v1/projects.rs
@@ -3,7 +3,7 @@ use std::collections::{BTreeMap, HashMap};
use axum::extract::{DefaultBodyLimit, State};
use axum::handler::Handler;
use axum::http::{header, HeaderValue};
-
use axum::response::IntoResponse;
+
use axum::response::{IntoResponse, Response};
use axum::routing::{get, patch, post};
use axum::{Json, Router};
use axum_auth::AuthBearer;
@@ -43,7 +43,12 @@ pub fn router(ctx: Context) -> Router {
            get(
                activity_handler.layer(SetResponseHeaderLayer::if_not_present(
                    header::CACHE_CONTROL,
-
                    HeaderValue::from_static(CACHE_1_HOUR),
+
                    |response: &Response| {
+
                        response
+
                            .status()
+
                            .is_success()
+
                            .then_some(HeaderValue::from_static(CACHE_1_HOUR))
+
                    },
                )),
            ),
        )