Apply review comment

This commit is contained in:
Alexandre de Souza 2025-07-23 14:58:04 -03:00
parent 01e5c71131
commit ce0b7b2e54
No known key found for this signature in database
GPG key ID: E39228FFBA346545

View file

@ -313,7 +313,6 @@ defmodule Livebook.Teams.Requests do
defp build_req(team) do
Req.new(base_url: Livebook.Config.teams_url())
|> Req.Request.put_new_header("x-lb-version", Livebook.Config.app_version())
|> Req.Request.append_response_steps(transform_teams_response: &transform_response/1)
|> Livebook.Utils.req_attach_defaults()
|> add_team_auth(team)
end
@ -341,25 +340,6 @@ defmodule Livebook.Teams.Requests do
Req.Request.merge_options(req, auth: {:bearer, token})
end
defp transform_response({request, response}) do
case {request, response} do
{request, %{status: 404}} when request.private.cli and request.private.deploy ->
{request,
%{
response
| status: 422,
body: %{"errors" => %{"deployment_group" => ["does not exist"]}}
}}
{request, %{status: 400, body: %{"errors" => %{"detail" => error}}}}
when request.private.deploy ->
{request, %{response | status: 422, body: %{"errors" => %{"file" => [error]}}}}
_otherwise ->
{request, response}
end
end
defp handle_response(response) do
case response do
{:ok, %{status: status} = response} when status in 200..299 -> {:ok, response.body}