Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/test/tesla/middleware/decode_rels_test.exs b/test/tesla/middleware/decode_rels_test.exs
index 6a32ff5..11f7961 100644
--- a/test/tesla/middleware/decode_rels_test.exs
+++ b/test/tesla/middleware/decode_rels_test.exs
@@ -1,38 +1,51 @@
defmodule Tesla.Middleware.DecodeRelsTest do
use ExUnit.Case
defmodule Client do
use Tesla
plug Tesla.Middleware.DecodeRels
adapter fn env ->
{:ok,
case env.url do
+ "/rels-with-no-quotes" ->
+ Tesla.put_headers(env, [
+ {"link", ~s(<https://api.github.com/resource?page=2>; rel=next,
+ <https://api.github.com/resource?page=5>; rel=last)}
+ ])
+
"/rels" ->
Tesla.put_headers(env, [
{"link", ~s(<https://api.github.com/resource?page=2>; rel="next",
<https://api.github.com/resource?page=5>; rel="last")}
])
_ ->
env
end}
end
end
test "deocde rels" do
assert {:ok, env} = Client.get("/rels")
assert env.opts[:rels] == %{
"next" => "https://api.github.com/resource?page=2",
"last" => "https://api.github.com/resource?page=5"
}
+
+ assert {:ok, unquoted_env} = Client.get("/rels-with-no-quotes")
+
+ assert unquoted_env.opts[:rels] == %{
+ "next" => "https://api.github.com/resource?page=2",
+ "last" => "https://api.github.com/resource?page=5"
+ }
end
test "skip if no Link header" do
assert {:ok, env} = Client.get("/")
assert env.opts[:rels] == nil
end
end

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 26, 5:21 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39781
Default Alt Text
(1 KB)

Event Timeline