coap_ex icon indicating copy to clipboard operation
coap_ex copied to clipboard

content_type vs content_format

Open WilliamTakeshi opened this issue 4 years ago • 0 comments

Hey :),

First of all, thanks a lot for the lib, I am enjoying using so far.

On Plug.Conn.req_headers, the coap_ex translate to content_format but plug translates to content-type

For example, the Plug.Conn.req_headers for a phoenix call

[ 
    {"connection", "keep-alive"},
    {"content-length", "9"},
    {"content-type", "application/json"},
    {"host", "localhost:4000"},
    {"te", ""}
]

but the Plug.Conn.req_headers for a coap_ex call

[
  content_format: "application/cbor",
  uri_host: "localhost",
  uri_path: ["broker", "api", "v2", "registry"],
  uri_port: 5683
]

because of that, I am having problems to write a parser for CBOR, since Plug.Parsers looks for content-type

WilliamTakeshi avatar Jan 21 '21 14:01 WilliamTakeshi