Http post request decoding issue golang EOF
<p>Request with postman is ok but in case of ajax call http: panic serving XXX.XXX.XXX.XXX:XXXXX: EOF </p>

<pre><code>func BodyToJson(r *http.Request)  map[string]interface{}{
    decoder := json.NewDecoder(r.Body);
    fmt.Println(reflect.TypeOf(r.Body).Kind())
    fmt.Println(decoder);
    var dat map[string]interface{}
    err := decoder.Decode(&amp;dat)
    if err!= nil{
        panic(err);
    }
    return dat
 }
</code></pre>