From ff789f76696256496b351fcc9e6c65369e7296f8 Mon Sep 17 00:00:00 2001 From: yiming <1965768941@qq.com> Date: Sat, 31 May 2025 19:47:05 +0800 Subject: [PATCH 1/2] add comment for bodyType param --- client.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client.go b/client.go index efee53c..0d92835 100644 --- a/client.go +++ b/client.go @@ -870,11 +870,27 @@ func (c *Client) Head(url string) (*http.Response, error) { } // Post is a shortcut for doing a POST request without making a new client. +// The bodyType parameter sets the "Content-Type" header of the request. +// Common content type values include: +// - "application/json" : For JSON-encoded data +// - "application/xml" : For XML payloads +// - "text/plain" : For plain text +// - "application/octet-stream" : For binary data +// - "application/x-www-form-urlencoded": For form submission data +// - "multipart/form-data" : For file uploads and complex forms func Post(url, bodyType string, body interface{}) (*http.Response, error) { return defaultClient.Post(url, bodyType, body) } // Post is a convenience method for doing simple POST requests. +// The bodyType parameter sets the "Content-Type" header of the request. +// Common content type values include: +// - "application/json" : For JSON-encoded data +// - "application/xml" : For XML payloads +// - "text/plain" : For plain text +// - "application/octet-stream" : For binary data +// - "application/x-www-form-urlencoded": For form submission data +// - "multipart/form-data" : For file uploads and complex forms func (c *Client) Post(url, bodyType string, body interface{}) (*http.Response, error) { req, err := NewRequest("POST", url, body) if err != nil { From 7cd69c09a978ec9acc6de1375f77e71d47e7d8a1 Mon Sep 17 00:00:00 2001 From: yiming <1965768941@qq.com> Date: Sun, 1 Jun 2025 04:12:20 +0800 Subject: [PATCH 2/2] add bodyType param descriptions --- client.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/client.go b/client.go index 0d92835..4b04533 100644 --- a/client.go +++ b/client.go @@ -871,26 +871,12 @@ func (c *Client) Head(url string) (*http.Response, error) { // Post is a shortcut for doing a POST request without making a new client. // The bodyType parameter sets the "Content-Type" header of the request. -// Common content type values include: -// - "application/json" : For JSON-encoded data -// - "application/xml" : For XML payloads -// - "text/plain" : For plain text -// - "application/octet-stream" : For binary data -// - "application/x-www-form-urlencoded": For form submission data -// - "multipart/form-data" : For file uploads and complex forms func Post(url, bodyType string, body interface{}) (*http.Response, error) { return defaultClient.Post(url, bodyType, body) } // Post is a convenience method for doing simple POST requests. // The bodyType parameter sets the "Content-Type" header of the request. -// Common content type values include: -// - "application/json" : For JSON-encoded data -// - "application/xml" : For XML payloads -// - "text/plain" : For plain text -// - "application/octet-stream" : For binary data -// - "application/x-www-form-urlencoded": For form submission data -// - "multipart/form-data" : For file uploads and complex forms func (c *Client) Post(url, bodyType string, body interface{}) (*http.Response, error) { req, err := NewRequest("POST", url, body) if err != nil {