use formdata instead of url encoded valus

This commit is contained in:
2025-03-27 13:28:03 -04:00
parent 9870b79854
commit 3f417b0088

View File

@@ -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