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: 11 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-03-27 02:31:39 * @LastEditTime: 2022-04-04 13:13:28 * @LastEditors: NyanCatda * @Description: 下载文件函数封装 * @FilePath: \Momizi\Internal\Plugin\JavaScriptV8\Tools\HttpRequest\Download.go

* @Author: NyanCatda * @Date: 2022-03-26 10:27:08 * @LastEditTime: 2022-04-04 13:10:34 * @LastEditors: NyanCatda * @Description: Get请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScriptV8\Tools\HttpRequest\Get.go

* @Author: NyanCatda * @Date: 2022-03-26 10:21:35 * @LastEditTime: 2022-04-04 13:15:23 * @LastEditors: NyanCatda * @Description: HttpRequest函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScriptV8\Tools\HttpRequest\HttpRequest.go

* @Author: NyanCatda * @Date: 2022-03-27 02:20:17 * @LastEditTime: 2022-04-04 13:09:14 * @LastEditors: NyanCatda * @Description: New请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScriptV8\Tools\HttpRequest\New.go

* @Author: NyanCatda * @Date: 2022-03-27 00:09:06 * @LastEditTime: 2022-04-04 13:12:38 * @LastEditors: NyanCatda * @Description: Post请求函数注册 * @FilePath: \Momizi\Internal\Plugin\JavaScriptV8\Tools\HttpRequest\Post.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallbackParameter

func CallbackParameter(Isolate *v8go.Isolate, Context *v8go.Context, Body []byte, HttpResponseValue *http.Response) (*v8go.Value, *v8go.Value, error)

*

  • @description: 回调参数解析
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @param {[]byte} Body 返回体
  • @param {*http.Response} HttpResponseValue 请求响应信息
  • @return {*v8go.Object } 返回回调参数(返回体)
  • @return {*v8go.Object } 返回回调参数(请求响应信息)
  • @return {error} 返回错误信息

func Download

func Download(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

func Get

func Get(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

*

  • @description: Get请求函数注册
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @return {*v8go.FunctionTemplate} Get请求函数

func New

func New(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

func PostFormData

func PostFormData(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

*

  • @description: Post请求函数注册,传递multipart/form-data
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @return {*v8go.FunctionTemplate} Post请求函数

func PostFormDataFile

func PostFormDataFile(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

*

  • @description: Post请求函数注册,带文件传递multipart/form-data
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @return {*v8go.FunctionTemplate} Post请求函数

func PostJson

func PostJson(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

*

  • @description: Post请求函数注册,传递Json
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @return {*v8go.FunctionTemplate} Post请求函数

func PostXWWWForm

func PostXWWWForm(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.FunctionTemplate, error)

*

  • @description Post请求函数注册,传递x-www-from-urlencoded
  • @param {*v8go.Isolate} Isolate v8实例
  • @param {*v8go.Context} Context v8上下文
  • @return {*v8go.FunctionTemplate} Post请求函数

func Register

func Register(Isolate *v8go.Isolate, Context *v8go.Context) (*v8go.Object, error)

Types

type HttpResponse

type HttpResponse struct {
	Status     string // e.g. "200 OK"
	StatusCode int    // e.g. 200
	Proto      string // e.g. "HTTP/1.0"
	ProtoMajor int    // e.g. 1
	ProtoMinor int    // e.g. 0

	// Header maps header keys to values. If the response had multiple
	// headers with the same key, they may be concatenated, with comma
	// delimiters.  (RFC 7230, section 3.2.2 requires that multiple headers
	// be semantically equivalent to a comma-delimited sequence.) When
	// Header values are duplicated by other fields in this struct (e.g.,
	// ContentLength, TransferEncoding, Trailer), the field values are
	// authoritative.
	//
	// Keys in the map are canonicalized (see CanonicalHeaderKey).
	Header map[string][]string

	// ContentLength records the length of the associated content. The
	// value -1 indicates that the length is unknown. Unless Request.Method
	// is "HEAD", values >= 0 indicate that the given number of bytes may
	// be read from Body.
	ContentLength int64

	// Contains transfer encodings from outer-most to inner-most. Value is
	// nil, means that "identity" encoding is used.
	TransferEncoding []string

	// Close records whether the header directed that the connection be
	// closed after reading Body. The value is advice for clients: neither
	// ReadResponse nor Response.Write ever closes a connection.
	Close bool

	// Uncompressed reports whether the response was sent compressed but
	// was decompressed by the http package. When true, reading from
	// Body yields the uncompressed content instead of the compressed
	// content actually set from the server, ContentLength is set to -1,
	// and the "Content-Length" and "Content-Encoding" fields are deleted
	// from the responseHeader. To get the original response from
	// the server, set Transport.DisableCompression to true.
	Uncompressed bool

	// Trailer maps trailer keys to values in the same
	// format as Header.
	//
	// The Trailer initially contains only nil values, one for
	// each key specified in the server's "Trailer" header
	// value. Those values are not added to Header.
	//
	// Trailer must not be accessed concurrently with Read calls
	// on the Body.
	//
	// After Body.Read has returned io.EOF, Trailer will contain
	// any trailer values sent by the server.
	Trailer map[string][]string
}

*

  • @description: Http返回体

func PointerHttpResponseToHttpResponse

func PointerHttpResponseToHttpResponse(HttpResponseValue *http.Response) HttpResponse

*

  • @description: 指针Http返回结构体转换
  • @param {*http.Response} HttpResponseValue
  • @return {*}

Jump to

Keyboard shortcuts

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