mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-03 12:48:38 -04:00
Stop using form elements for API
Just send the JSON as the request body
This commit is contained in:
@ -223,14 +223,8 @@ func ReportHandler(r *http.Request, context *Context) ResponseWriterWriter {
|
||||
}
|
||||
|
||||
if r.Method == "POST" {
|
||||
report_json := r.PostFormValue("report")
|
||||
if report_json == "" {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
|
||||
var report Report
|
||||
err := report.Read(report_json)
|
||||
if err != nil {
|
||||
if err := ReadJSON(r, &report); err != nil {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
report.ReportId = -1
|
||||
@ -283,14 +277,8 @@ func ReportHandler(r *http.Request, context *Context) ResponseWriterWriter {
|
||||
}
|
||||
|
||||
if r.Method == "PUT" {
|
||||
report_json := r.PostFormValue("report")
|
||||
if report_json == "" {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
|
||||
var report Report
|
||||
err := report.Read(report_json)
|
||||
if err != nil || report.ReportId != reportid {
|
||||
if err := ReadJSON(r, &report); err != nil || report.ReportId != reportid {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
report.UserId = user.UserId
|
||||
|
Reference in New Issue
Block a user