From 62e855e1b6ed4ad3a53391dbcc4eafae5048354f Mon Sep 17 00:00:00 2001 From: KKlochko Date: Tue, 1 Aug 2023 17:59:34 +0300 Subject: [PATCH] Fix the route path in LinkController.create/2. --- CHANGELOG.org | 2 ++ lib/link_shortener_web/controllers/api/v1/link_controller.ex | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 75853cb..e438dc5 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -30,4 +30,6 @@ Update the controller and the view for updated Link model. ** 0.4.4 <2023-08-01 Tue> Fix Links.update_one/2. +** 0.4.5 <2023-08-01 Tue> + Fix the route path in LinkController.create/2. diff --git a/lib/link_shortener_web/controllers/api/v1/link_controller.ex b/lib/link_shortener_web/controllers/api/v1/link_controller.ex index e4abb51..c4bd5ad 100644 --- a/lib/link_shortener_web/controllers/api/v1/link_controller.ex +++ b/lib/link_shortener_web/controllers/api/v1/link_controller.ex @@ -15,7 +15,7 @@ defmodule LinkShortenerWeb.Api.V1.LinkController do with {:ok, %Link{} = link} <- Links.insert_one(link_params) do conn |> put_status(:created) - |> put_resp_header("location", Routes.link_path(conn, :show, link)) + |> put_resp_header("location", Routes.v1_link_path(conn, :show, link)) |> render("show.json", link: link) end end