Uploaded file gets corrupted when using GRPC custom middleware in tyk-gateway 2.7.0

Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 80 (#0)
> POST /test HTTP/1.1
> Host: localhost:80
> User-Agent: curl/7.54.0
> Accept: */*
> Authorization: Bearer abcd
> Content-Length: 798
> Expect: 100-continue
> content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW; boundary=------------------------42f5a57c8daa8cf0
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Content-Length: 0
< Date: Fri, 10 Aug 2018 06:34:01 GMT
< X-Ratelimit-Limit: 0
< X-Ratelimit-Remaining: 0
< X-Ratelimit-Reset: 0
< Connection: close
< 
* Closing connection 0

However I tried with a JSON file instead of a JPG one, and it worked

body.length is 928
raw_body.length is 928

Do you think the problem could be related to

if utf8.Valid(miniRequestObject.RawBody) {

in coprocess.go (tyk/coprocess.go at 7172b91d6cb0fb57b37ea452b57ca45515b33e71 · TykTechnologies/tyk · GitHub)?