Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions net/gclient/gclient_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"bytes"
"context"
"io"
"mime"
"mime/multipart"
"net/http"
"os"
Expand Down Expand Up @@ -172,7 +173,8 @@ func (c *Client) prepareRequest(ctx context.Context, method, url string, data ..
allowFileUploading = true
)
if len(data) > 0 {
switch c.header[httpHeaderContentType] {
mediaType, _, _ := mime.ParseMediaType(c.header[httpHeaderContentType])
Comment thread
wanghaolong613 marked this conversation as resolved.
Outdated
switch mediaType {
case httpHeaderContentTypeJson:
switch data[0].(type) {
case string, []byte:
Expand Down Expand Up @@ -206,7 +208,8 @@ func (c *Client) prepareRequest(ctx context.Context, method, url string, data ..
if method == http.MethodGet {
var bodyBuffer *bytes.Buffer
if params != "" {
switch c.header[httpHeaderContentType] {
mediaType, _, _ := mime.ParseMediaType(c.header[httpHeaderContentType])
Comment thread
wanghaolong613 marked this conversation as resolved.
Outdated
switch mediaType {
case
httpHeaderContentTypeJson,
httpHeaderContentTypeXml:
Expand Down
Loading