Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add trailing slashes to URL conf paths (#801)

Dhruv Bhanushali3c9a1205f07f
diff --git a/api/catalog/api/views/oauth2_views.py b/api/catalog/api/views/oauth2_views.py
index 45990451c..580dfb7f1 100644
--- a/api/catalog/api/views/oauth2_views.py
+++ b/api/catalog/api/views/oauth2_views.py
@@ -68,7 +68,7 @@ curl \\
-X POST \\
-H "Content-Type: application/json" \\
-d '{"name": "My amazing project", "description": "To access Openverse API", "email": "[email protected]"}' \\
- https://api.openverse.engineering/v1/auth_tokens/register
+ https://api.openverse.engineering/v1/auth_tokens/register/
""" # noqa: E501
register_api_oauth2_request = openapi.Schema(
@@ -241,7 +241,7 @@ You can use this endpoint to get information about your API key such as
key_info_bash = """
curl \\
-H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" \\
- http://api.openverse.engineering/v1/rate_limit
+ http://api.openverse.engineering/v1/rate_limit/
"""
@swagger_auto_schema(
diff --git a/api/catalog/urls/__init__.py b/api/catalog/urls/__init__.py
index 0faf1676c..b3c44e0a8 100644
--- a/api/catalog/urls/__init__.py
+++ b/api/catalog/urls/__init__.py
@@ -35,7 +35,7 @@ discontinuation_message = {
}
versioned_paths = [
- path("rate_limit", CheckRates.as_view(), name="key_info"),
+ path("rate_limit/", CheckRates.as_view(), name="key_info"),
path("auth_tokens/", include(auth_tokens_patterns)),
# Deprecated, redirects to new URL
path(
diff --git a/api/catalog/urls/auth_tokens.py b/api/catalog/urls/auth_tokens.py
index a6b586c07..3631bbc4d 100644
--- a/api/catalog/urls/auth_tokens.py
+++ b/api/catalog/urls/auth_tokens.py
@@ -4,7 +4,7 @@ from catalog.api.views.oauth2_views import Register, VerifyEmail
urlpatterns = [
- path("register", Register.as_view(), name="register"),
+ path("register/", Register.as_view(), name="register"),
path("verify/<str:code>", VerifyEmail.as_view(), name="verify-email"),
path("", include("oauth2_provider.urls", namespace="oauth2_provider")),
]
diff --git a/api/test/api_live_integration.py b/api/test/api_live_integration.py
index c5b88235a..70c31140b 100644
--- a/api/test/api_live_integration.py
+++ b/api/test/api_live_integration.py
@@ -228,7 +228,7 @@ def test_oauth2_registration():
"description": "A key for testing the OAuth2 registration process.",
"email": "[email protected]",
}
- response = requests.post(f"{API_URL}/oauth2/register", json=payload, verify=False)
+ response = requests.post(f"{API_URL}/oauth2/register/", json=payload, verify=False)
parsed_response = json.loads(response.text)
assert response.status_code == 201
return parsed_response
diff --git a/api/test/auth_test.py b/api/test/auth_test.py
index 37aac9579..e6e308eed 100644
--- a/api/test/auth_test.py
+++ b/api/test/auth_test.py
@@ -19,7 +19,7 @@ def test_auth_tokens_registration(client):
"email": "[email protected]",
}
res = client.post(
- "/v1/auth_tokens/register",
+ "/v1/auth_tokens/register/",
data,
verify=False,
)
@@ -70,7 +70,7 @@ def test_auth_rate_limit_reporting(client, test_auth_token_exchange, verified=Fa
# the token.
time.sleep(1)
token = test_auth_token_exchange["access_token"]
- res = client.get("/v1/rate_limit", HTTP_AUTHORIZATION=f"Bearer {token}")
+ res = client.get("/v1/rate_limit/", HTTP_AUTHORIZATION=f"Bearer {token}")
res_data = res.json()
if verified:
assert res_data["rate_limit_model"] == "standard"