Improve gemini response field names
This commit is contained in:
parent
56fb4fe38c
commit
c5bbc439eb
|
@ -1,5 +1,5 @@
|
|||
defmodule Chronoscope.Gemini.Response do
|
||||
@response_pattern ~r/^(?<status>[0-9]{2}) (?<mime_type>.+)\r\n(?<body>(?s:.)*)/
|
||||
@response_pattern ~r/^(?<status_code>[0-9]{2}) (?<meta>.+)\r\n(?<body>(?s:.)*)/
|
||||
|
||||
def parse(response) do
|
||||
response
|
||||
|
@ -14,7 +14,7 @@ defmodule Chronoscope.Gemini.Response do
|
|||
|
||||
match ->
|
||||
match
|
||||
|> Map.update!("status", &String.to_integer/1)
|
||||
|> Map.update!("status_code", &String.to_integer/1)
|
||||
|> to_atom_keys()
|
||||
|> then(&{:ok, &1})
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ defmodule ChronoscopeWeb.API.V1.Gemini.ConnectionController do
|
|||
end
|
||||
|
||||
defp format_response(response) do
|
||||
Map.take(response, [:status, :mime_type, :body, :cert_expiration])
|
||||
Map.take(response, [:status_code, :meta, :body, :cert_expiration])
|
||||
end
|
||||
|
||||
defp bad_request_response(conn, message) do
|
||||
|
|
Loading…
Reference in New Issue