fix(server): use explicit #[get] and #[post] attributes for server endpoints
All checks were successful
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 2m30s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Deploy (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 2m21s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Deploy (pull_request) Has been skipped

Replace #[server(endpoint = "...")] with explicit HTTP method attributes
to ensure correct method handling behind Traefik reverse proxy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-02-20 13:04:50 +01:00
parent 680de0500e
commit 9f4e269e94
4 changed files with 8 additions and 5 deletions

View File

@@ -1733,6 +1733,9 @@
.text-center {
text-align: center;
}
.lowercase {
text-transform: lowercase;
}
.outline {
outline-style: var(--tw-outline-style);
outline-width: 1px;

View File

@@ -159,7 +159,7 @@ mod inner {
/// # Errors
///
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
#[server(endpoint = "summarize")]
#[post("/api/summarize")]
pub async fn summarize_article(
snippet: String,
article_url: String,
@@ -258,7 +258,7 @@ pub struct FollowUpMessage {
/// # Errors
///
/// Returns `ServerFnError` if the Ollama request fails or response parsing fails
#[server(endpoint = "chat")]
#[post("/api/chat")]
pub async fn chat_followup(
messages: Vec<FollowUpMessage>,
ollama_url: String,

View File

@@ -45,7 +45,7 @@ struct OllamaModel {
///
/// Returns `ServerFnError` only on serialization issues; network failures
/// are caught and returned as `online: false`
#[server(endpoint = "ollama-status")]
#[post("/api/ollama-status")]
pub async fn get_ollama_status(ollama_url: String) -> Result<OllamaStatus, ServerFnError> {
dotenvy::dotenv().ok();

View File

@@ -110,7 +110,7 @@ mod inner {
/// # Errors
///
/// Returns `ServerFnError` if the SearXNG request fails or response parsing fails
#[server(endpoint = "search")]
#[post("/api/search")]
pub async fn search_topic(query: String) -> Result<Vec<NewsCard>, ServerFnError> {
dotenvy::dotenv().ok();
use inner::{extract_source, rank_and_deduplicate, SearxngResponse};
@@ -196,7 +196,7 @@ pub async fn search_topic(query: String) -> Result<Vec<NewsCard>, ServerFnError>
/// # Errors
///
/// Returns `ServerFnError` if the SearXNG search request fails
#[server(endpoint = "trending")]
#[get("/api/trending")]
pub async fn get_trending_topics() -> Result<Vec<String>, ServerFnError> {
dotenvy::dotenv().ok();
use inner::SearxngResponse;