Skip to content

Commit

Permalink
Add EnableForceMultipart/DisableForceMultipart for Request
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Aug 29, 2022
1 parent f2fd2d9 commit 592eee8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 13 additions & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 12 additions & 0 deletions request_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 592eee8

Please sign in to comment.