go-ozzo / ozzo-routing

An extremely fast Go (golang) HTTP router that supports regular expression route matching. Comes with full support for building RESTful APIs.
MIT License
455 stars 51 forks source link

Unable to get POST data from app/json request #47

Closed HaseProgram closed 6 years ago

HaseProgram commented 6 years ago

Hi! I Got issue when there is no way to get data with content-type app/json (while urlencoded form works fine) I tried both of methods (in source code they looks similar):

email := c.PostForm("email")
email := c.Form("email")

Also tried context.Read() like it was shown in README but with no result - also empty response. Here is the example of my request:

POST http://localhost:8080/api/user/username/create HTTP/1.1
Accept: application/json
Content-Type: application/json
{
  "about": "About me.",
  "email": "hello@mail.com",
  "fullname": "John Smith"
}

All of theese fields are empty in c *routing.Context. Can you help me and show me what I'm doing wrong? Thanks in advice!