MCPcopy Create free account
hub / github.com/clawshell/clawshell / build_rewritten_uri

Function build_rewritten_uri

src/app.rs:1075–1084  ·  view source on GitHub ↗

Build a new URI with a rewritten path, preserving query string. Incoming axum URIs are path-only (no scheme/authority), so we build path-only too.

(original: &Uri, new_path: &str)

Source from the content-addressed store, hash-verified

1073/// Build a new URI with a rewritten path, preserving query string.
1074/// Incoming axum URIs are path-only (no scheme/authority), so we build path-only too.
1075fn build_rewritten_uri(original: &Uri, new_path: &str) -> Result<Uri, String> {
1076 let path_and_query = if let Some(query) = original.query() {
1077 format!("{new_path}?{query}")
1078 } else {
1079 new_path.to_string()
1080 };
1081 path_and_query
1082 .parse::<Uri>()
1083 .map_err(|e| format!("failed to build rewritten URI: {e}"))
1084}
1085
1086fn ensure_stream_options(body: &[u8], provider: Provider) -> Option<Vec<u8>> {
1087 if !matches!(provider, Provider::Openai | Provider::Openrouter) {

Callers 1

forward_oauth_requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected