Accent v0.1.1 Accent.Plug.Request
Transforms the keys of an HTTP request’s params to the same or a different case.
You can specify what case to convert keys to by passing in a :transformer
option.
Accent supports the following transformers out of the box:
Accent.Transformer.CamelCase
(e.g.CamelCase
)Accent.Transformer.PascalCase
(e.g.pascalCase
)Accent.Transformer.SnakeCase
(e.g.snake_case
)
If no transformer is provided then Accent.Transformer.SnakeCase
will be
used.
Please note that this plug will need to be executed after the request has been parsed.
Example
plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison
plug Accent.Plug.Request, transformer: Accent.Transformer.CamelCase