{"action":"closed","issue":{"url":"https://api.github.com/repos/gin-gonic/gin/issues/1357","repository_url":"https://api.github.com/repos/gin-gonic/gin","labels_url":"https://api.github.com/repos/gin-gonic/gin/issues/1357/labels{/name}","comments_url":"https://api.github.com/repos/gin-gonic/gin/issues/1357/comments","events_url":"https://api.github.com/repos/gin-gonic/gin/issues/1357/events","html_url":"https://github.com/gin-gonic/gin/issues/1357","id":322982326,"number":1357,"title":"Sending a multipart.File to another micro-service","user":{"login":"adriendomoison","id":9092210,"avatar_url":"https://avatars0.githubusercontent.com/u/9092210?v=4","gravatar_id":"","url":"https://api.github.com/users/adriendomoison","html_url":"https://github.com/adriendomoison","followers_url":"https://api.github.com/users/adriendomoison/followers","following_url":"https://api.github.com/users/adriendomoison/following{/other_user}","gists_url":"https://api.github.com/users/adriendomoison/gists{/gist_id}","starred_url":"https://api.github.com/users/adriendomoison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriendomoison/subscriptions","organizations_url":"https://api.github.com/users/adriendomoison/orgs","repos_url":"https://api.github.com/users/adriendomoison/repos","events_url":"https://api.github.com/users/adriendomoison/events{/privacy}","received_events_url":"https://api.github.com/users/adriendomoison/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-14T21:08:56Z","updated_at":"2018-05-25T19:42:00Z","closed_at":"2018-05-25T19:42:00Z","author_association":"NONE","body":"I am retrieving a file from a multipart/form-data upload with `file, header, err := c.Request.FormFile(\"file\")` and after some processing I need to send the file to another micro-service.\r\nI was trying to use a classic POST and BIND with a structure like that\r\n```\r\n\r\ntype RequestDTOWithFile struct {\r\n\tFile        *multipart.File `json:\"file\"`\r\n\tPublicId    string         `json:\"order_id\"`\r\n\tName        string         `json:\"name\"`\r\n\tUserId      uint           `json:\"user_id\"`\r\n}\r\n\r\n// send a RequestDTOWithFile from first micro service\r\nhttp.NewRequest(\"POST\", url, data) \r\n\r\n...\r\n// recieve a RequestDTOWithFile from an other micro service\r\nc.Bind(&data)\r\n\r\n```\r\n\r\nBut I got stuck with `json: cannot unmarshal object into Go struct field RequestDTOWithFile.file of type multipart.File`\r\n\r\nIs there a way to achieve that with gin?\r\n\r\nFor now, the only solution I found that could work is to recreate a multipart form like this https://stackoverflow.com/questions/20205796/golang-post-data-using-the-content-type-multipart-form-data/20397167 which is not elegant."}}
{"actor":{"display_login":"adriendomoison"}}