request

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTlsConfig added in v0.1.18

func NewTlsConfig(caPath, certPath, keyPath string) (*tls.Config, error)

* * NewTlsConfig * @param caPath, certPath, keyPath string * @return *tls.Config, error *

Types

type Body

type Body struct {
	Data []byte
}

* * Body struct to convert the body response *

func ReadBody

func ReadBody(body io.ReadCloser) (*Body, error)

* * ReadBody reads the body response * @param body io.ReadCloser * @return *Body * @return error *

func (Body) ToArrayJson

func (b Body) ToArrayJson() ([]et.Json, error)

* * ToArrayJson returns a Json array object * @return []et.Json *

func (Body) ToBool

func (b Body) ToBool() (bool, error)

* * ToBool returns a boolean * @return bool *

func (Body) ToFloat

func (b Body) ToFloat() (float64, error)

* * ToFloat returns a float * @return float64 *

func (Body) ToInt

func (b Body) ToInt() (int, error)

* * ToInt returns an integer * @return int *

func (Body) ToInt64

func (b Body) ToInt64() (int64, error)

* * ToInt64 returns an integer * @return int64 *

func (Body) ToJson

func (b Body) ToJson() (et.Json, error)

* * ToJson returns a Json object * @return et.Json *

func (Body) ToString

func (b Body) ToString() string

* * ToString returns a string * @return string *

func (Body) ToTime

func (b Body) ToTime() (time.Time, error)

* * ToTime returns a time * @return time.Time *

type Response added in v0.1.17

type Response struct {
	Body   *Body
	Status Status
	Header et.Json
}

func Fetch added in v0.1.17

func Fetch(method, url string, header, body et.Json) (*Response, error)

* * Fetch * @param method, url string, header, body et.Json * @return *Response, error *

func FetchWithTls added in v0.1.18

func FetchWithTls(method, url string, header, body et.Json, tlsConfig *tls.Config) (*Response, error)

* * FetchWithTls * @param method, url string, header, body et.Json, tlsConfig *tls.Config * @return *Response, error *

func (*Response) ToJson added in v0.1.17

func (r *Response) ToJson() et.Json

* * ToJson returns a Json object * @return et.Json *

type Status

type Status struct {
	Ok      bool   `json:"ok"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Status) ToJson

func (s Status) ToJson() et.Json

ToJson returns a Json object

func (Status) ToString

func (s Status) ToString() string

ToString returns a string

Jump to

Keyboard shortcuts

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