From c5bbc439eb9651bf783dea3fb9d28960f14f7bf3 Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Sun, 5 May 2024 09:56:27 -0400 Subject: [PATCH] Improve gemini response field names --- lib/chronoscope/gemini/response.ex | 4 ++-- .../controllers/api/v1/gemini/connection_controller.ex | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chronoscope/gemini/response.ex b/lib/chronoscope/gemini/response.ex index 5b70843..f1e4320 100644 --- a/lib/chronoscope/gemini/response.ex +++ b/lib/chronoscope/gemini/response.ex @@ -1,5 +1,5 @@ defmodule Chronoscope.Gemini.Response do - @response_pattern ~r/^(?[0-9]{2}) (?.+)\r\n(?(?s:.)*)/ + @response_pattern ~r/^(?[0-9]{2}) (?.+)\r\n(?(?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 diff --git a/lib/chronoscope_web/controllers/api/v1/gemini/connection_controller.ex b/lib/chronoscope_web/controllers/api/v1/gemini/connection_controller.ex index 7d77324..2448ce4 100644 --- a/lib/chronoscope_web/controllers/api/v1/gemini/connection_controller.ex +++ b/lib/chronoscope_web/controllers/api/v1/gemini/connection_controller.ex @@ -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