use formdata instead of url encoded valus
This commit is contained in:
@@ -49,10 +49,6 @@ func GetMessage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func DeleteMessage(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodDelete {
|
||||
http.Error(w, "Invalid request method", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
message, ok := r.Context().Value(messageKey{}).(*Message)
|
||||
if !ok || message == nil {
|
||||
render.Render(w, r, ErrNotFound)
|
||||
@@ -82,12 +78,7 @@ func newMessageID() string {
|
||||
}
|
||||
|
||||
func NewMessage(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
http.Error(w, "Invalid request method", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
err := r.ParseForm()
|
||||
err := r.ParseMultipartForm(32 << 20)
|
||||
if err != nil {
|
||||
http.Error(w, "Unable to parse form", http.StatusBadRequest)
|
||||
return
|
||||
|
Reference in New Issue
Block a user