Skip to content

Commit

Permalink
Normalize test endpoint port
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumm committed Oct 5, 2022
1 parent fb4376f commit 04686ee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions lib/absinthe_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ defmodule AbsintheClient do
Performing a `subscription` operation:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> Req.request!(req,
...> web_socket: ws,
Expand All @@ -167,7 +167,7 @@ defmodule AbsintheClient do
Performing an asynchronous `subscription` operation and awaiting the reply:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> res = Req.request!(req,
...> web_socket: ws,
Expand All @@ -189,7 +189,7 @@ defmodule AbsintheClient do
Authorization via the request `:auth` option:
iex> req = Req.new(base_url: "http://localhost:8001/", auth: {:bearer, "valid-token"}) |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002/", auth: {:bearer, "valid-token"}) |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!(url: "/auth-socket/websocket")
iex> res = Req.request!(req,
...> web_socket: ws,
Expand All @@ -212,7 +212,7 @@ defmodule AbsintheClient do
Custom authorization via `:connect_params` map literal:
iex> req =
...> Req.new(base_url: "http://localhost:8001/")
...> Req.new(base_url: "http://localhost:4002/")
...> |> AbsintheClient.attach(connect_params: %{"token" => "valid-token"})
iex> ws = req |> AbsintheClient.WebSocket.connect!(url: "/auth-socket/websocket")
iex> res = Req.request!(req,
Expand All @@ -236,7 +236,7 @@ defmodule AbsintheClient do
Failed authorization replies will timeout:
iex> req =
...> Req.new(base_url: "http://localhost:8001/", auth: {:bearer, "invalid-token"})
...> Req.new(base_url: "http://localhost:4002/", auth: {:bearer, "invalid-token"})
...> |> AbsintheClient.attach(retry: :never)
iex> ws = req |> AbsintheClient.WebSocket.connect!(url: "/auth-socket/websocket")
iex> res = Req.request!(req,
Expand Down
26 changes: 13 additions & 13 deletions lib/absinthe_client/web_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ defmodule AbsintheClient.WebSocket do
Performing a `query` operation over a WebSocket:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> Req.request!(req, web_socket: ws, graphql: ~S|{ __type(name: "Repo") { name } }|).body["data"]
%{"__type" => %{"name" => "Repo"}}
Performing an async `query` operation and awaiting the reply:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> reply =
...> req
Expand Down Expand Up @@ -96,14 +96,14 @@ defmodule AbsintheClient.WebSocket do
From a request:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> {:ok, ws} = req |> AbsintheClient.WebSocket.connect()
iex> ws |> GenServer.whereis() |> Process.alive?()
true
From keyword options:
iex> {:ok, ws} = AbsintheClient.WebSocket.connect(url: "ws://localhost:8001/socket/websocket")
iex> {:ok, ws} = AbsintheClient.WebSocket.connect(url: "ws://localhost:4002/socket/websocket")
iex> ws |> GenServer.whereis() |> Process.alive?()
true
"""
Expand All @@ -128,14 +128,14 @@ defmodule AbsintheClient.WebSocket do
With the default URL path:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> {:ok, ws} = req |> AbsintheClient.WebSocket.connect()
iex> ws |> GenServer.whereis() |> Process.alive?()
true
With a custom URL path:
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> {:ok, ws} = req |> AbsintheClient.WebSocket.connect(url: "/socket/websocket")
iex> ws |> GenServer.whereis() |> Process.alive?()
true
Expand Down Expand Up @@ -226,13 +226,13 @@ defmodule AbsintheClient.WebSocket do
From a request:
iex> ws = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.WebSocket.connect!()
iex> ws = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.WebSocket.connect!()
iex> ws |> GenServer.whereis() |> Process.alive?()
true
From keyword options:
iex> ws = AbsintheClient.WebSocket.connect!(url: "ws://localhost:8001/socket/websocket")
iex> ws = AbsintheClient.WebSocket.connect!(url: "ws://localhost:4002/socket/websocket")
iex> ws |> GenServer.whereis() |> Process.alive?()
true
"""
Expand All @@ -250,7 +250,7 @@ defmodule AbsintheClient.WebSocket do
## Examples
iex> ws =
...> Req.new(base_url: "http://localhost:8001")
...> Req.new(base_url: "http://localhost:4002")
...> |> AbsintheClient.WebSocket.connect!(url: "/socket/websocket")
iex> ws |> GenServer.whereis() |> Process.alive?()
true
Expand Down Expand Up @@ -278,7 +278,7 @@ defmodule AbsintheClient.WebSocket do
## Examples
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach()
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach()
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> Req.request!(req, web_socket: ws, graphql: ~S|{ __type(name: "Repo") { name } }|).body["data"]
%{"__type" => %{"name" => "Repo"}}
Expand Down Expand Up @@ -313,7 +313,7 @@ defmodule AbsintheClient.WebSocket do
## Examples
iex> {:ok, req} = AbsintheClient.WebSocket.connect(url: "ws://localhost:8001/socket/websocket")
iex> {:ok, req} = AbsintheClient.WebSocket.connect(url: "ws://localhost:4002/socket/websocket")
iex> ref = AbsintheClient.WebSocket.push(req, ~S|{ __type(name: "Repo") { name } }|)
iex> AbsintheClient.WebSocket.await_reply!(ref).payload["data"]
%{"__type" => %{"name" => "Repo"}}
Expand Down Expand Up @@ -344,7 +344,7 @@ defmodule AbsintheClient.WebSocket do
## Examples
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach(async: true)
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach(async: true)
iex> {:ok, ws} = AbsintheClient.WebSocket.connect(req)
iex> {:ok, res} = Req.request(req, web_socket: ws, graphql: ~S|{ __type(name: "Repo") { name } }|)
iex> {:ok, reply} = AbsintheClient.WebSocket.await_reply(res)
Expand Down Expand Up @@ -381,7 +381,7 @@ defmodule AbsintheClient.WebSocket do
## Examples
iex> req = Req.new(base_url: "http://localhost:8001") |> AbsintheClient.attach(async: true)
iex> req = Req.new(base_url: "http://localhost:4002") |> AbsintheClient.attach(async: true)
iex> ws = req |> AbsintheClient.WebSocket.connect!()
iex> res = Req.post!(req, web_socket: ws, graphql: ~S|{ __type(name: "Repo") { name } }|)
iex> AbsintheClient.WebSocket.await_reply!(res).payload["data"]
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Application.put_env(:absinthe_client, AbsintheClientTest.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 8001],
http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "HOJE5xctETrtYS5RfAG+Ivz35iKH7JXyVz7MN6ExwmjIDVMVXoMbpHrp8ZEt++cK",
check_origin: false,
pubsub_server: AbsintheClientTest.PubSub,
Expand Down

0 comments on commit 04686ee

Please sign in to comment.