Skip to content

Commit a06602a

Browse files
committed
length validator fails if gets nil value
1 parent a309bd2 commit a06602a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/jsonrpc2_plug/validator/rule.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ defmodule JSONRPC2Plug.Validator.Rule do
1111

1212
defmacro __using__(_) do
1313
quote location: :keep do
14-
def rule(opts \\ []),
15-
do: fn(value) -> check(value, opts) end
14+
def rule(opts \\ []) do
15+
fn
16+
(nil) -> :ok
17+
(value) -> check(value, opts)
18+
end
19+
end
1620

1721
defoverridable [rule: 1]
1822

0 commit comments

Comments
 (0)