diff --git a/request.go b/request.go index 3366a8d4..7ea8c23c 100644 --- a/request.go +++ b/request.go @@ -867,7 +867,19 @@ func (r *Request) EnableForceChunkedEncoding() *Request { // DisableForceChunkedEncoding disables force using chunked encoding when uploading. func (r *Request) DisableForceChunkedEncoding() *Request { - r.forceChunkedEncoding = true + r.forceChunkedEncoding = false + return r +} + +// EnableForceMultipart enables force using multipart to upload form data. +func (r *Request) EnableForceMultipart() *Request { + r.isMultiPart = true + return r +} + +// DisableForceMultipart disables force using multipart to upload form data. +func (r *Request) DisableForceMultipart() *Request { + r.isMultiPart = true return r } diff --git a/request_wrapper.go b/request_wrapper.go index ac775fbc..a78a0684 100644 --- a/request_wrapper.go +++ b/request_wrapper.go @@ -332,6 +332,18 @@ func DisableForceChunkedEncoding() *Request { return defaultClient.R().DisableForceChunkedEncoding() } +// EnableForceMultipart is a global wrapper methods which delegated +// to the default client, create a request and EnableForceMultipart for request. +func EnableForceMultipart() *Request { + return defaultClient.R().EnableForceMultipart() +} + +// DisableForceMultipart is a global wrapper methods which delegated +// to the default client, create a request and DisableForceMultipart for request. +func DisableForceMultipart() *Request { + return defaultClient.R().DisableForceMultipart() +} + // EnableDumpTo is a global wrapper methods which delegated // to the default client, create a request and EnableDumpTo for request. func EnableDumpTo(output io.Writer) *Request {