Page MenuHomePhorge

No OneTemporary

Size
2 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 779c02e..e01de96 100644
--- a/test/tesla/middleware/decode_rels_test.exs
+++ b/test/tesla/middleware/decode_rels_test.exs
@@ -1,51 +1,66 @@
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-semi-colon-in-quote" ->
+ Tesla.put_headers(env, [
+ {"link", ~s(<https://api.github.com/resource?page=2>; rel=next,
+ <https://api.github.com/resource?page=5>; rel="some;back",
+ <https://api.github.com/resource?page=5>; rel=last)}
+ ])
+
"/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 "decode 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"
}
+
+ assert {:ok, unquoted_env} = Client.get("/rels-with-semi-colon-in-quote")
+
+ assert unquoted_env.opts[:rels] == %{
+ "next" => "https://api.github.com/resource?page=2",
+ "last" => "https://api.github.com/resource?page=5",
+ "some;back" => "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
Mon, Nov 25, 11:42 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39777
Default Alt Text
(2 KB)

Event Timeline