Skip to content

Commit

Permalink
Change plug method
Browse files Browse the repository at this point in the history
  • Loading branch information
tolyo committed Dec 10, 2023
1 parent 03fc8b1 commit b01feec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/nitroux/plug.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
defmodule Nitroux.Plug do
import Plug.Conn

@spec content(
Plug.Conn.t(),
binary() | maybe_improper_list()
) :: Plug.Conn.t()
def content(conn, data) do
data =
case data do
Expand All @@ -9,6 +13,6 @@ defmodule Nitroux.Plug do
end

%{conn | resp_headers: [{"content-type", "text/html"}]}
|> send_resp(conn.status || 200, data)
|> resp(conn.status || 200, data)
end
end
7 changes: 4 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Nitroux.MixProject do
def project do
[
app: :nitroux,
version: "0.4.0",
version: "0.4.1",
elixir: "~> 1.13",
name: "nitroux",
description: description(),
Expand All @@ -28,8 +28,9 @@ defmodule Nitroux.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:plug, "~> 1.13", runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
{:plug, "~> 1.13"},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, "~> 1.4.2", only: [:dev]}
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
Expand Down

0 comments on commit b01feec

Please sign in to comment.