Skip to content

Commit

Permalink
Merge pull request #780 from bcgov/chore/update-default-api-version
Browse files Browse the repository at this point in the history
chore: redirect swagger to /v4
  • Loading branch information
swcurran authored Apr 28, 2024
2 parents ae860b1 + 0523d2e commit f376b83
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions server/vcr-server/api/v2/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class SwaggerSchemaView(APIView):
def get(self, request):
params = {"urlconf": "api.v2.urls"}
if "HTTP_X_FORWARDED_HOST" in request.META:
# forwarding via vcr-web
# params["url"] = "{}://{}/api".format(
# request.META.get("HTTP_X_FORWARDED_PROTO", "http"),
# request.META["HTTP_X_FORWARDED_HOST"])
params["url"] = "/api"
else:
params["url"] = "/api/v2"
Expand Down
4 changes: 2 additions & 2 deletions server/vcr-server/vcr_server/middleware/tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def test_get_coalesced_request_version_header_nopath(self):
def test_get_coalesced_request_version_noheader_path(self):
result = self.routing_middleware.get_coalesced_request_version(None, "latest")

self.assertEqual(result, "v3")
self.assertEqual(result, "v4")

def test_get_coalesced_request_version_header_path_matching(self):
result = self.routing_middleware.get_coalesced_request_version("latest", "latest")

self.assertEqual(result, "v3")
self.assertEqual(result, "v4")

def test_get_coalesced_request_version_header_path_conflicting(self):
with self.assertRaises(ApiVersionException) as cm:
Expand Down
5 changes: 2 additions & 3 deletions server/vcr-server/vcr_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ def parse_bool(val):
u"v2": u"v2",
u"v3": u"v3",
u"v4": u"v4",
u"alpha": u"v4",
u"latest": u"v3",
u"default": u"v2",
u"latest": u"v4",
u"default": u"v4",
}

0 comments on commit f376b83

Please sign in to comment.