Correção dos casos:

- Host não pode ser caminho inválido. Melhor optar por IP caso seja um mock-up ao invés de colocar um endpoint inválido pois o API Gateway testa
- schema: Se o host não estiver com http:// ou https:// o serviço não estava pegando de schema. Corrigido
This commit is contained in:
2024-03-11 10:27:31 -03:00
parent 98266a1b7d
commit b42a644ce3
2 changed files with 634 additions and 621 deletions

View File

@@ -307,9 +307,16 @@ def accMethods_v2(routes, path, status):
METHOD = (METHOD + " " + method).lstrip().upper()
return METHOD
def check_endpoint(endpoint):
def check_endpoint(schemes, endpoint):
if (schemes == ""):
if (endpoint.find("http://") == -1 and endpoint.find("https://") == -1):
endpoint = "https://" + endpoint
else:
if (endpoint.find("http://") == -1 and endpoint.find("https://") == -1):
if (schemes.find("://") == -1):
endpoint = schemes + "://" + endpoint
else:
endpoint = schemes + endpoint
return endpoint
def key_func(k):
@@ -412,7 +419,13 @@ def process_api_spec(api_id, compartmentId, environment, swagger, functionId, ho
PATH_PREFIX = find_base_path(spec["path"])
METHOD = accMethods(api_spec["routes"], PATH, status)
else:
fullEndpoint = check_endpoint((endPoint + removeLastSlash(fullSpec["basePath"]) + spec["path"]).replace("{", "${request.path[").replace("}", "]}"))
schemes = ""
try:
schemes = fullSpec["schemes"][0]
except:
schemes = "https"
fullEndpoint = check_endpoint(schemes, (endPoint + removeLastSlash(fullSpec["basePath"]) + spec["path"]).replace("{", "${request.path[").replace("}", "]}"))
FULL_PATH = fullSpec["basePath"] + spec["path"]
ENDPOINT = fullEndpoint
PATH = spec["path"]