mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-02 20:28:38 -04:00
Stop using form elements for API
Just send the JSON as the request body
This commit is contained in:
@ -136,14 +136,8 @@ func PriceHandler(r *http.Request, context *Context) ResponseWriterWriter {
|
||||
}
|
||||
|
||||
if r.Method == "POST" {
|
||||
price_json := r.PostFormValue("price")
|
||||
if price_json == "" {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
|
||||
var price Price
|
||||
err := price.Read(price_json)
|
||||
if err != nil {
|
||||
if err := ReadJSON(r, &price); err != nil {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
price.PriceId = -1
|
||||
@ -196,14 +190,8 @@ func PriceHandler(r *http.Request, context *Context) ResponseWriterWriter {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
if r.Method == "PUT" {
|
||||
price_json := r.PostFormValue("price")
|
||||
if price_json == "" {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
|
||||
var price Price
|
||||
err := price.Read(price_json)
|
||||
if err != nil || price.PriceId != priceid {
|
||||
if err := ReadJSON(r, &price); err != nil || price.PriceId != priceid {
|
||||
return NewError(3 /*Invalid Request*/)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user