1 Star 0 Fork 0

micro-tools/wf

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
client_bytes.go 2.27 KB
Copy Edit Raw Blame History
545403892 authored 2023-09-27 22:16 . 升级go-ole
package client
// GetBytes sends a GET request, retrieves and returns the result content as bytes.
func (c *Client) GetBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("GET", url, data...)
}
// PutBytes sends a PUT request, retrieves and returns the result content as bytes.
func (c *Client) PutBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("PUT", url, data...)
}
// PostBytes sends a POST request, retrieves and returns the result content as bytes.
func (c *Client) PostBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("POST", url, data...)
}
// DeleteBytes sends a DELETE request, retrieves and returns the result content as bytes.
func (c *Client) DeleteBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("DELETE", url, data...)
}
// HeadBytes sends a HEAD request, retrieves and returns the result content as bytes.
func (c *Client) HeadBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("HEAD", url, data...)
}
// PatchBytes sends a PATCH request, retrieves and returns the result content as bytes.
func (c *Client) PatchBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("PATCH", url, data...)
}
// ConnectBytes sends a CONNECT request, retrieves and returns the result content as bytes.
func (c *Client) ConnectBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("CONNECT", url, data...)
}
// OptionsBytes sends a OPTIONS request, retrieves and returns the result content as bytes.
func (c *Client) OptionsBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("OPTIONS", url, data...)
}
// TraceBytes sends a TRACE request, retrieves and returns the result content as bytes.
func (c *Client) TraceBytes(url string, data ...interface{}) []byte {
return c.RequestBytes("TRACE", url, data...)
}
// RequestBytes sends request using given HTTP method and data, retrieves returns the result
// as bytes. It reads and closes the response object internally automatically.
func (c *Client) RequestBytes(method string, url string, data ...interface{}) []byte {
response, err := c.DoRequest(method, url, data...)
if err != nil {
return nil
}
defer response.Close()
return response.ReadAll()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/micro-tools/wf.git
git@gitee.com:micro-tools/wf.git
micro-tools
wf
wf
v1.0.2

Search