I'm trying to send the HTML formated data from angular-JS to Go Lang API server. I'm Using Angular Trix and sending the HTML formated Data To API.
Here is My Angular-Js Service Class code....
sendblogData(data,key){
console.log(angular.toJson(data))
this.$http({
url:"/api/BlogPost",
method:"POST",
data:{
"blogData":angular.toJson(data),
"blogId": key
}
}).then((response)=>{
if(response.data.status === "success") {
console.log("mission successfull......")
}
})
}
And Here Is my Go Lang Controller Code
func blogDetailsPost(c *gin.Context) {
var request struct {
ID string `json:"blogId"`
BlogDetails string `json:"blogData"`
}
if c.Bind(&request) == nil {
fmt.Println("request", request.BlogDetails)
c.JSON(200, gin.H{
"status": "success",
"message": "Mision successfull....",
})
}
}
But I'm getting 400 Bad Request Response.
Can Any One please suggest me where i make mistake.