• 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

Recently I created a http handle function and configured the route with gin.Wrapf() .

func UploadImage(w http.ResponseWriter, r *http.Request) {
...
     reader, err := r.MultipartReader()
...
}
v1.POST("/searchbyimage", gin.WrapF(vertical.UploadImage))

The following error always occurred when calling the function.

http: multipart handled by ParseMultipartForm

I tried debugger but couldn't find the cause.

Please tell me how to avoid calling ParseMultipartForm() inside gin.

How to reproduce

package main

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

func main() {
    g := gin.Default()
    g.GET("/hello/:name", func(c *gin.Context) {
        c.String(200, "Hello %s", c.Param("name"))
    })
    g.Run(":9000")
}

Expectations

$ curl http://localhost:8201/hello/world
Hello world

Actual result

$ curl -i http://localhost:8201/hello/world
<YOUR RESULT>

Environment

  • go version:
  • gin version (or commit ref):
  • operating system:

Comment From: dvaldivia

hitting the same issue

Comment From: nccapo

Anyone having the same error please see source: https://github.com/golang/go/issues/18767#issuecomment-274656873