gin icon indicating copy to clipboard operation
gin copied to clipboard

Problem about delete method included a body

Open seamory opened this issue 1 year ago • 0 comments

  • With issues:
    • Use the search tool before opening a new issue.
    • Please provide source code and commit sha if you found a bug.
    • Review existing issues and provide feedback or react to them.

Description

Delete method in gin can accept and process the body at lest when context-type is form-data or application/json. this situation conflict the #795

How to reproduce

package main

import (
	"github.com/gin-gonic/gin"
)

func main() {
	g := gin.Default()
	g.Delete("/test", func(c *gin.Context) {
                fmt.Println(c.GetPostForm("id"))
	})
	g.Run(":9000")
}

Expectations

Using postman request the 127.0.0.1:9000/test via by delete method, and set body with form-data or json type. it's will print id value.

Actual result

Actually, according to #795, delete method can't include body.

Environment

  • go version: 1.18.3
  • gin version (or commit ref): 1.7.7
  • operating system: windows 10

seamory avatar Jun 10 '22 05:06 seamory