Skip to content

Commit

Permalink
Merge pull request #122 from iKonoTelecomunicaciones/121-fix-set-exte…
Browse files Browse the repository at this point in the history
…rnal-variables-endpoint-response

fix(api): 🐛 Fixed set external variables endpoint
  • Loading branch information
egalvis39 committed Jun 6, 2024
2 parents e23f3f5 + 998af78 commit 318028e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion menuflow/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def init(cfg: Config, loop: AbstractEventLoop) -> web.Application:
allow_credentials=True,
expose_headers="*",
allow_headers="*",
allow_methods=["GET", "POST", "OPTIONS", "PATCH"],
allow_methods=["GET", "POST", "OPTIONS", "PATCH", "PUT"],
)
},
)
Expand Down
2 changes: 1 addition & 1 deletion menuflow/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def set_variables(request: web.Request) -> web.Response:

await room.set_variable(variable_id="external", value=variables)

return resp.ok
return resp.ok({"detail": {"message": "Variables set successfully"}})


# Update or create new flow
Expand Down
14 changes: 8 additions & 6 deletions menuflow/nodes/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ async def make_request(self):
f"node: {self.id} method: {self.method} url: {self.url} status: {response.status}"
)

if response.status >= 400:
self.log.debug(f"Response: {await response.text()}")

if response.status == 401:
o_connection = None
if not self.middleware:
Expand Down Expand Up @@ -230,12 +233,11 @@ async def run_middleware(self, status: int):
{
self.room.room_id: {
"last_http_node": self.id,
"attempts_count": self.HTTP_ATTEMPTS.get(self.room.room_id, {}).get(
"attempts_count"
)
+ 1
if self.HTTP_ATTEMPTS.get(self.room.room_id)
else 1,
"attempts_count": (
self.HTTP_ATTEMPTS.get(self.room.room_id, {}).get("attempts_count") + 1
if self.HTTP_ATTEMPTS.get(self.room.room_id)
else 1
),
}
}
)
Expand Down

0 comments on commit 318028e

Please sign in to comment.