Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ import Config
config :logger, :level, :warning

config :phoenix, :json_library, Jason

config :req, legacy_headers_as_lists: true
4 changes: 2 additions & 2 deletions lib/absinthe_client/web_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defmodule AbsintheClient.WebSocket do
will be prepended to this path. The default value is
`"/socket/websocket"`.

* `:headers` - list of headers to send on the initial
* `:headers` - headers to send on the initial
HTTP request. Defaults to `[]`.

* `:connect_options` - list of options given to
Expand Down Expand Up @@ -206,7 +206,7 @@ defmodule AbsintheClient.WebSocket do

config_options = [
uri: req.url,
headers: req.headers,
headers: Req.get_headers_list(req),
mint_opts: [
protocols: [:http1],
transport_opts: transport_opts
Expand Down
14 changes: 7 additions & 7 deletions lib/absinthe_client/web_socket/absinthe_ws.ex
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ defmodule AbsintheClient.WebSocket.AbsintheWs do
defp reply(%Push{} = push, push_ref, result),
do: reply(%Reply{event: push.event, ref: push.ref, push_ref: push_ref}, result)

defp reply(reply, :ok), do: %Reply{reply | status: :ok, payload: nil}
defp reply(reply, :error), do: %Reply{reply | status: :error, payload: nil}
defp reply(%Reply{} = reply, :ok), do: %{reply | status: :ok, payload: nil}
defp reply(%Reply{} = reply, :error), do: %{reply | status: :error, payload: nil}

defp reply(reply, {:ok, payload}),
do: %Reply{reply | status: :ok, payload: payload(reply, payload)}
defp reply(%Reply{} = reply, {:ok, payload}),
do: %{reply | status: :ok, payload: payload(reply, payload)}

defp reply(reply, {:error, payload}),
do: %Reply{reply | status: :error, payload: error_payload(reply, payload)}
defp reply(%Reply{} = reply, {:error, payload}),
do: %{reply | status: :error, payload: error_payload(reply, payload)}

defp payload(reply, %{"subscriptionId" => subscription_id}) do
defp payload(%Reply{} = reply, %{"subscriptionId" => subscription_id}) do
%AbsintheClient.Subscription{
socket: self(),
ref: reply.ref,
Expand Down
9 changes: 4 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ defmodule Absinthe.Socket.MixProject do
aliases: [
"test.all": ["test --include integration"]
],
preferred_cli_env: [
"test.all": :test,
docs: :docs,
"hex.publish": :docs
],
test_coverage: [summary: [threshold: 80]]
]
end
Expand All @@ -32,6 +27,10 @@ defmodule Absinthe.Socket.MixProject do
]
end

def cli do
[preferred_envs: ["test.all": :test, docs: :docs, "hex.publish": :docs]]
end

defp package do
[
description: "AbsintheClient is a GraphQL client designed for Elixir Absinthe.",
Expand Down
Loading
Loading