Skip to content

Commit 380212f

Browse files
authored
Add generic :custom_error on HTTP/2 frames (#445)
1 parent 4f0c534 commit 380212f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/mint/http2/frame.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,7 @@ defmodule Mint.HTTP2.Frame do
472472
defp humanize_error_code(unquote(code)), do: unquote(human_code)
473473
defp dehumanize_error_code(unquote(human_code)), do: unquote(code)
474474
end
475+
476+
defp humanize_error_code(code), do: {:custom_error, code}
477+
defp dehumanize_error_code({:custom_error, code}), do: code
475478
end

test/mint/http2/frame_test.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ defmodule Mint.HTTP2.FrameTest do
294294
:connect_error,
295295
:enhance_your_calm,
296296
:inadequate_security,
297-
:http_1_1_required
297+
:http_1_1_required,
298+
{:custom_error, 0x11},
299+
{:custom_error, 0xFF},
300+
{:custom_error, 70007}
298301
])
299302
end
300303
end

0 commit comments

Comments
 (0)