knutin / elli

Simple, robust and performant Erlang web server
MIT License
663 stars 79 forks source link

Does elli support content-type is "application/json" for POST method? #103

Closed wangyangkobe closed 7 years ago

wangyangkobe commented 8 years ago

Hi, For Post method, the payload is json format, just like:

{  
   "UserId":"5",
   "Token":"b4f61c3e465847d481433d6c3ba086fb",
   "MacList":[  
      {  
         "Mac":"98:7B:F3:5A:61:70"
      }
   ]
}

So does elli support content-type is "application/json" for POST method?

knutin commented 8 years ago

Elli supports any content type and just gives you the body as a big binary.

If you want it to automatically be decoded, you can use a middleware to do it for you. There's one already for encoding the response (https://github.com/sthadka/elli_json) Maybe you can enhance it with a preprocess pass.