Maxwell.Middleware.Json (maxwell v2.4.0) View Source
Encode request's body to json when request's body is not nil
Decode response's body to json when reponse's header contain {'Content-Type', "application/json"}
and body is binary
or Reponse's body is list
It will auto add %{'Content-Type': 'application/json'}
to request's headers
Default json_lib is Poison
Examples
# Client.ex
use Maxwell.Builder ~(get)a
middleware Maxwell.Middleware.Json
# OR
middleware Maxwell.Middleware.Json,
encode_content_type: "application/json",
encode_func: &other_json_lib.encode/1,
decode_content_types: ["yourowntype"],
decode_func: &other_json_lib.decode/1