mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 20:28:23 +00:00
clean up unsupported endpoints
This commit is contained in:
@@ -234,14 +234,6 @@ _ALLOWED_ENDPOINTS: dict[str, frozenset[str]] = {
|
||||
"responses": frozenset({"POST"}),
|
||||
"messages": frozenset({"POST"}),
|
||||
"embeddings": frozenset({"POST"}),
|
||||
"moderations": frozenset({"POST"}),
|
||||
"rerank": frozenset({"POST"}),
|
||||
"audio/speech": frozenset({"POST"}),
|
||||
"audio/transcriptions": frozenset({"POST"}),
|
||||
"audio/translations": frozenset({"POST"}),
|
||||
"images/generations": frozenset({"POST"}),
|
||||
"images/edits": frozenset({"POST"}),
|
||||
"images/variations": frozenset({"POST"}),
|
||||
"models": frozenset({"GET"}),
|
||||
"attestation": frozenset({"GET"}),
|
||||
"tee/attestation": frozenset({"GET"}),
|
||||
|
||||
@@ -69,6 +69,24 @@ def test_unknown_paths_are_not_forwarded() -> None:
|
||||
assert _forwarding_allowed("secret-endpoint", "POST") is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
[
|
||||
"moderations",
|
||||
"rerank",
|
||||
"audio/speech",
|
||||
"audio/transcriptions",
|
||||
"audio/translations",
|
||||
"images/generations",
|
||||
"images/edits",
|
||||
"images/variations",
|
||||
],
|
||||
)
|
||||
def test_unbilled_endpoints_are_not_forwarded_by_default(path: str) -> None:
|
||||
assert _forwarding_allowed(path, "POST") is False
|
||||
assert _forwarding_allowed(f"v1/{path}", "POST") is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
[
|
||||
@@ -121,9 +139,6 @@ def test_known_prefix_does_not_carry_an_unknown_endpoint(path: str) -> None:
|
||||
("v1/responses", "POST"),
|
||||
("v1/messages", "POST"),
|
||||
("v1/embeddings", "POST"),
|
||||
("moderations", "POST"),
|
||||
("audio/transcriptions", "POST"),
|
||||
("images/generations", "POST"),
|
||||
("models", "GET"),
|
||||
("attestation", "GET"),
|
||||
("tee/attestation", "GET"),
|
||||
|
||||
Reference in New Issue
Block a user