HttpRequest

package
v0.0.0-...-3e87f45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpRequests

func HttpRequests(VM *goja.Runtime) error

*

  • @description: Http请求类
  • @param {*goja.Runtime} VM 加载器
  • @return {*}

Types

type HttpRequest

type HttpRequest struct {
	VM *goja.Runtime
}

*

  • @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响应

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL