Repository: go-resty/resty (go)

Issue:
Call to http.DetectContentType has trailing NUL bytes in buffer
In [`writeMultipartFormFile`](https://github.com/go-resty/resty/blob/v2/util.go#L211), the call to `http.DetectContentType` is passed a buffer with potentially trailing `0` bytes.  As a result, `text/plain` is never detected in such cases.

`cbuf` should be trimmed to `size` to ensure `text/plain` is property detected:

```go
// Auto detect actual multipart content type
cbuf := make([]byte, 512)
size, err := r.Read(cbuf)
if err != nil && err != io.EOF {
  return err
}

partWriter, err := w.CreatePart(createMultipartHeader(fieldName, fileName, http.DetectContentType(cbuf[:size])))
if err != nil {
  return err
}
```

Pull request description:
fix: trailing NULL bytes in buffer while detecting a content type
Closes #754 

Patch:
diff --git a/util.go b/util.go
index 27b466d..5a69e4f 100644
--- a/util.go
+++ b/util.go
@@ -216,7 +216,7 @@ func writeMultipartFormFile(w *multipart.Writer, fieldName, fileName string, r i
 		return err
 	}
 
-	partWriter, err := w.CreatePart(createMultipartHeader(fieldName, fileName, http.DetectContentType(cbuf)))
+	partWriter, err := w.CreatePart(createMultipartHeader(fieldName, fileName, http.DetectContentType(cbuf[:size])))
 	if err != nil {
 		return err
 	}


Test patch:
diff --git a/middleware_test.go b/middleware_test.go
index f4e5c69..f5924cb 100644
--- a/middleware_test.go
+++ b/middleware_test.go
@@ -756,7 +756,7 @@ func Test_parseRequestBody(t *testing.T) {
 			expectedContentLength: "744",
 		},
 		{
-			name: "mulipart fields",
+			name: "multipart fields",
 			init: func(c *Client, r *Request) {
 				r.SetMultipartFields(
 					&MultipartField{
@@ -776,7 +776,7 @@ func Test_parseRequestBody(t *testing.T) {
 			expectedContentLength: "344",
 		},
 		{
-			name: "mulipart files",
+			name: "multipart files",
 			init: func(c *Client, r *Request) {
 				r.SetFileReader("foo", "foo.txt", strings.NewReader("1")).
 					SetFileReader("bar", "bar.txt", strings.NewReader("2")).
@@ -784,7 +784,7 @@ func Test_parseRequestBody(t *testing.T) {
 			},
 			expectedBodyBuf:       []byte(`{"bar":"2","foo":"1"}`),
 			expectedContentType:   "multipart/form-data; boundary=",
-			expectedContentLength: "412",
+			expectedContentLength: "414",
 		},
 		{
 			name: "body with errorReader",