github.com/gogf/gf@v1.16.9/net/ghttp/internal/client/client_content.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package client 8 9 // GetContent is a convenience method for sending GET request, which retrieves and returns 10 // the result content and automatically closes response object. 11 func (c *Client) GetContent(url string, data ...interface{}) string { 12 return string(c.RequestBytes("GET", url, data...)) 13 } 14 15 // PutContent is a convenience method for sending PUT request, which retrieves and returns 16 // the result content and automatically closes response object. 17 func (c *Client) PutContent(url string, data ...interface{}) string { 18 return string(c.RequestBytes("PUT", url, data...)) 19 } 20 21 // PostContent is a convenience method for sending POST request, which retrieves and returns 22 // the result content and automatically closes response object. 23 func (c *Client) PostContent(url string, data ...interface{}) string { 24 return string(c.RequestBytes("POST", url, data...)) 25 } 26 27 // DeleteContent is a convenience method for sending DELETE request, which retrieves and returns 28 // the result content and automatically closes response object. 29 func (c *Client) DeleteContent(url string, data ...interface{}) string { 30 return string(c.RequestBytes("DELETE", url, data...)) 31 } 32 33 // HeadContent is a convenience method for sending HEAD request, which retrieves and returns 34 // the result content and automatically closes response object. 35 func (c *Client) HeadContent(url string, data ...interface{}) string { 36 return string(c.RequestBytes("HEAD", url, data...)) 37 } 38 39 // PatchContent is a convenience method for sending PATCH request, which retrieves and returns 40 // the result content and automatically closes response object. 41 func (c *Client) PatchContent(url string, data ...interface{}) string { 42 return string(c.RequestBytes("PATCH", url, data...)) 43 } 44 45 // ConnectContent is a convenience method for sending CONNECT request, which retrieves and returns 46 // the result content and automatically closes response object. 47 func (c *Client) ConnectContent(url string, data ...interface{}) string { 48 return string(c.RequestBytes("CONNECT", url, data...)) 49 } 50 51 // OptionsContent is a convenience method for sending OPTIONS request, which retrieves and returns 52 // the result content and automatically closes response object. 53 func (c *Client) OptionsContent(url string, data ...interface{}) string { 54 return string(c.RequestBytes("OPTIONS", url, data...)) 55 } 56 57 // TraceContent is a convenience method for sending TRACE request, which retrieves and returns 58 // the result content and automatically closes response object. 59 func (c *Client) TraceContent(url string, data ...interface{}) string { 60 return string(c.RequestBytes("TRACE", url, data...)) 61 } 62 63 // RequestContent is a convenience method for sending custom http method request, which 64 // retrieves and returns the result content and automatically closes response object. 65 func (c *Client) RequestContent(method string, url string, data ...interface{}) string { 66 return string(c.RequestBytes(method, url, data...)) 67 }