Handle body post using Iris-go
<p>I'm new in Golang, I've been doing some code tests to build an REST API using Iris framework, I'm trying to get the body data from a Post to my API but I cannot make it works, I did read the <strong>Body binder</strong> <a href="http://iris-go.com/body_binder/" rel="nofollow">http://iris-go.com/body_binder/</a> and followed the examples. The result I get is an empty structure:</p>

<p>My code:</p>

<pre><code>package main

import (
  "github.com/kataras/iris"
  "fmt"
)

type PostAPI struct {
 *iris.Context
}

type Lead struct {
 fbId string
 email string
 telefono string
 version string
 mac string
 os string
}

func (p PostAPI)  Post(){

  lead := Lead{}
  err := p.ReadJSON(&amp;lead)

  if (err != nil) {

    fmt.Println("Error on reading form: " + err.Error())
    return
  }
  fmt.Printf("Post! %v", lead)
}

func main() {

  iris.API("/", PostAPI{})
  iris.Listen(":8080")
}
</code></pre>

<p>The post:</p>

<pre><code>curl -H "Content-Type: application/json" -X POST -d '{"fbId": "werwer","email": "werwer@gmail.com","telefono": "5555555555","version": "123","mac": "3j:3j:3j:3j","os": "uno bien chido"}' http://0.0.0.0:8080/
</code></pre>

<p>The result:</p>

<pre><code>Post! {     }
</code></pre>

<p>What am I doing wrong?</p>