Skip to main content

normalise

Function normalise 

Source
pub fn normalise(endpoint: &str) -> String
Expand description

Canonical form of an endpoint for use as a store key.

Lowercased and stripped of trailing slashes. https://API.Z.AI/v1/ and https://api.z.ai/v1 are the same host and the same credential, and a store that disagreed would report “no key” for a config that had just stored one - a failure with no visible cause, since both spellings look right.

Deliberately no more than that: the path is significant (/v1 and /anthropic/v1 are different APIs on the same host, and can carry different keys), so nothing beyond the trailing slash is trimmed.