Documentation ¶
Overview ¶
* @Author: nijineko * @Date: 2024-08-29 19:53:53 * @LastEditTime: 2024-09-01 05:16:05 * @LastEditors: nijineko * @Description: 请求体处理 * @FilePath: \yuzuhttp\request\body.go
* @Author: nijineko * @Date: 2024-09-01 04:22:54 * @LastEditTime: 2024-09-01 04:22:59 * @LastEditors: nijineko * @Description: cookie处理 * @FilePath: \yuzuhttp\request\cookie.go
* @Author: nijineko * @Date: 2024-08-29 19:48:25 * @LastEditTime: 2024-08-29 20:02:31 * @LastEditors: nijineko * @Description: 请求头处理 * @FilePath: \yuzuhttp\request\header.go
* @Author: nijineko * @Date: 2024-08-29 19:40:54 * @LastEditTime: 2024-08-30 17:25:10 * @LastEditors: nijineko * @Description: 请求处理 * @FilePath: \yuzuhttp\request\request.go
* @Author: nijineko * @Date: 2024-08-29 20:18:41 * @LastEditTime: 2024-08-29 20:20:53 * @LastEditors: nijineko * @Description: 参数设置 * @FilePath: \yuzuhttp\request\setting.go
* @Author: nijineko * @Date: 2024-08-29 19:54:36 * @LastEditTime: 2024-09-02 02:27:39 * @LastEditors: nijineko * @Description: URL参数处理 * @FilePath: \yuzuhttp\request\urlValue.go
Index ¶
- type Request
- func (r *Request) AddCookie(Key, Value string) *Request
- func (r *Request) AddHeader(Key, Value string) *Request
- func (r *Request) AddQuery(key, value string) *Request
- func (r *Request) AddURLValue(Key, Value string) *Request
- func (r *Request) Do() *response.Response
- func (r *Request) GetCookie(Key string) string
- func (r *Request) GetHeader(Key string) string
- func (r *Request) GetURLValue(Key string) string
- func (r *Request) RemoveCookie(Key string) *Request
- func (r *Request) RemoveHeader(Key string) *Request
- func (r *Request) RemoveURLValue(Key string) *Request
- func (r *Request) SetBody(Body io.ReadCloser) *Request
- func (r *Request) SetBodyBytes(Body []byte) *Request
- func (r *Request) SetBodyFormData(FormData *multipartForm.Form) *Request
- func (r *Request) SetBodyFormUrlencoded(FormData map[string]string) *Request
- func (r *Request) SetBodyJSON(JsonData any) *Request
- func (r *Request) SetBodyString(Body string) *Request
- func (r *Request) SetBodyXML(XMLData any) *Request
- func (r *Request) SetCookies(Cookies map[string]string) *Request
- func (r *Request) SetEnableHTTPProxy(Enable bool) *Request
- func (r *Request) SetEnableNon200Error(Enable bool) *Request
- func (r *Request) SetHeaders(Headers map[string]string) *Request
- func (r *Request) SetQuerys(Params map[string]string) *Request
- func (r *Request) SetURLValues(Params map[string]string) *Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Method string // 请求方法 URL string // 请求地址 URLValue map[string]string // GET参数 Header map[string]string // 请求头 Cookie map[string]string // Cookie Body io.ReadCloser // 请求体 Error error // 错误 // contains filtered or unexported fields }
请求对象
func New ¶
*
- @description: 初始化请求
- @param {string} method 请求方法
- @param {string} url 请求地址
- @return {*Request} 请求对象
func (*Request) AddCookie ¶ added in v0.2.0
*
- @description: 添加Cookie
- @param {string} Key Key
- @param {string} Value Value
- @return {*Request} 请求对象
func (*Request) AddHeader ¶
*
- @description: 添加请求头
- @param {string} Key Key
- @param {string} Value Value
func (*Request) AddQuery ¶ added in v0.2.1
*
- @description: 添加URL参数
- @param {string} Key Key
- @param {string} Value Value
- @return {*Request} 请求对象
func (*Request) AddURLValue ¶
*
- @description: 添加URL参数
- @param {string} Key Key
- @param {string} Value Value
- @return {*Request} 请求对象
func (*Request) GetCookie ¶ added in v0.2.0
*
- @description: 获取Cookie
- @param {string} Key Key
- @return {string} Value
func (*Request) GetURLValue ¶
*
- @description: 获取URL参数
- @param {string} Key Key
- @return {string} Value
func (*Request) RemoveCookie ¶ added in v0.2.0
*
- @description: 移除Cookie
- @param {string} Key Key
- @return {*Request} 请求对象
func (*Request) RemoveHeader ¶
*
- @description: 移除请求头
- @param {string} key Key
- @return {*Request} 请求对象
func (*Request) RemoveURLValue ¶
*
- @description: 移除URL参数
- @param {string} Key Key
- @return {*Request} 请求对象
func (*Request) SetBody ¶
func (r *Request) SetBody(Body io.ReadCloser) *Request
*
- @description: 设置请求体
- @param {io.ReadCloser} Body 请求体
- @return {*Request} 请求对象
func (*Request) SetBodyBytes ¶
*
- @description: 设置Bytes请求体
- @param {[]byte} Body 请求体
- @return {*Request} 请求对象
func (*Request) SetBodyFormData ¶
func (r *Request) SetBodyFormData(FormData *multipartForm.Form) *Request
*
- @description: 设置FormData格式请求体
- @param {map[string]string} FormData 表单数据
- @return {*Request} 请求对象
func (*Request) SetBodyFormUrlencoded ¶
*
- @description: 设置FormUrlencoded格式请求体
- @param {map[string]string} FormData 表单数据
- @return {*Request} 请求对象
func (*Request) SetBodyJSON ¶ added in v0.2.0
*
- @description: 设置Json格式请求体
- @param {any} JsonData Json数据
- @return {*Request} 请求对象
func (*Request) SetBodyString ¶
*
- @description: 设置String请求体
- @param {string} Body 请求体
- @return {*Request} 请求对象
func (*Request) SetBodyXML ¶ added in v0.2.0
*
- @description: 设置XML格式请求体
- @param {any} XMLData XML数据
- @return {*Request} 请求对象
func (*Request) SetCookies ¶ added in v0.2.0
*
- @description: 设置Cookie
- @param {map[string]string} Cookies Cookie
- @return {*Request} 请求对象
func (*Request) SetEnableHTTPProxy ¶
*
- @description: 设置是否启用HTTP代理环境变量支持
- @param {bool} enable
- @return {*Request}
func (*Request) SetEnableNon200Error ¶
*
- @description: 设置是否启用非200状态码时返回错误
- @param {bool} enable
- @return {*Request}
Directories ¶
Path | Synopsis |
---|---|
* @Author: nijineko * @Date: 2024-08-30 16:37:03 * @LastEditTime: 2024-08-30 17:09:25 * @LastEditors: nijineko * @Description: 表单处理封装 * @FilePath: \yuzuhttp\request\multipartForm\multipartForm.go
|
* @Author: nijineko * @Date: 2024-08-30 16:37:03 * @LastEditTime: 2024-08-30 17:09:25 * @LastEditors: nijineko * @Description: 表单处理封装 * @FilePath: \yuzuhttp\request\multipartForm\multipartForm.go |