Documentation ¶
Overview ¶
* @Author: NyanCatda * @Date: 2022-03-22 17:36:42 * @LastEditTime: 2022-03-23 21:44:44 * @LastEditors: NyanCatda * @Description: 下载文件函数 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\HttpRequest\Download.go
* @Author: NyanCatda * @Date: 2022-03-21 13:58:24 * @LastEditTime: 2022-03-23 21:44:55 * @LastEditors: NyanCatda * @Description: Get请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\HttpRequest\Get.go
* @Author: NyanCatda * @Date: 2022-03-21 13:55:04 * @LastEditTime: 2022-03-21 13:57:29 * @LastEditors: NyanCatda * @Description: Http请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\HttpRequest\HttpRequest.go
* @Author: NyanCatda * @Date: 2022-03-21 14:52:53 * @LastEditTime: 2022-03-23 21:45:04 * @LastEditors: NyanCatda * @Description: 请求请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\HttpRequest\New.go
* @Author: NyanCatda * @Date: 2022-03-21 14:14:03 * @LastEditTime: 2022-03-27 02:06:04 * @LastEditors: NyanCatda * @Description: Post请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\HttpRequest\Post.go
Index ¶
- func HttpRequests(VM *goja.Runtime) error
- type HttpRequest
- func (HttpRequest HttpRequest) Download(URL string, Header []string, SavePath string, Callback goja.Callable)
- func (HttpRequest HttpRequest) Get(URL string, Header []string, Callback goja.Callable)
- func (HttpRequest HttpRequest) New(Method string, URL string, Header []string, RequestBody string, ...)
- func (HttpRequest HttpRequest) PostFormData(URL string, Header []string, Data map[string]string, Callback goja.Callable)
- func (HttpRequest HttpRequest) PostFormDataFile(URL string, Header []string, Data map[string]string, FileKey string, ...)
- func (HttpRequest HttpRequest) PostJson(URL string, Header []string, requestBody string, Callback goja.Callable)
- func (HttpRequest HttpRequest) PostXWWWForm(URL string, Header []string, Data map[string]string, Callback goja.Callable)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpRequest ¶
*
- @description: Http请求类
func (HttpRequest) Download ¶
func (HttpRequest HttpRequest) Download(URL string, Header []string, SavePath string, Callback goja.Callable)
*
- @description: 下载文件函数
- @param {string} URL 下载地址
- @param {[]string} Header 请求头
- @param {string} SavePath 保存路径
- @param {goja.Callable} Callback 回调函数
- @return {string} FilePath 文件保存路径
- @return {int64} FileSize 文件大小(Byte)
func (HttpRequest) Get ¶
func (HttpRequest HttpRequest) Get(URL string, Header []string, Callback goja.Callable)
*
- @description: GET请求函数注册
- @param {string} URL 请求地址
- @param {[]string} Header 头部信息
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应
func (HttpRequest) New ¶
func (HttpRequest HttpRequest) New(Method string, URL string, Header []string, RequestBody string, Callback goja.Callable)
*
- @description: 新建请求函数注册
- @param {string} Method 请求方法 GET/POST/PUT/DELETE...
- @param {string} URL 请求地址
- @param {[]string} Header 请求头
- @param {string} RequestBody 请求内容
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应
func (HttpRequest) PostFormData ¶
func (HttpRequest HttpRequest) PostFormData(URL string, Header []string, Data map[string]string, Callback goja.Callable)
*
- @description: POST请求函数注册,传递multipart/form-data
- @param {string} URL 请求地址
- @param {[]string} Header 请求头
- @param {map[string]string} Data 请求内容(multipart/form-data)
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应
func (HttpRequest) PostFormDataFile ¶
func (HttpRequest HttpRequest) PostFormDataFile(URL string, Header []string, Data map[string]string, FileKey string, FilePath []string, Callback goja.Callable)
*
- @description: POST请求函数注册,带文件传递multipart/form-data
- @param {string} URL 请求地址
- @param {[]string} Header 请求头
- @param {map[string]string} Data 请求内容(multipart/form-data)
- @param {string} FileKey 文件key
- @param {[]string} FilePath 文件路径
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应
func (HttpRequest) PostJson ¶
func (HttpRequest HttpRequest) PostJson(URL string, Header []string, requestBody string, Callback goja.Callable)
*
- @description: POST请求函数注册,传递Json
- @param {string} URL 请求地址
- @param {[]string} Header 请求头
- @param {string} requestBody 请求内容(Json)
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应
func (HttpRequest) PostXWWWForm ¶
func (HttpRequest HttpRequest) PostXWWWForm(URL string, Header []string, Data map[string]string, Callback goja.Callable)
*
- @description: POST请求函数注册,传递x-www-from-urlencoded
- @param {string} URL 请求地址
- @param {[]string} Header 请求头
- @param {map[string]string} Data 请求内容(x-www-from-urlencoded)
- @param {goja.Callable} Callback 回调函数
- @return {[]byte} Body 请求返回内容
- @return {*http.Response} HttpResponse Http响应