request

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App added in v1.0.12

func App(r *http.Request) string

* * App * @param r *http.Request * @return string *

func Delete

func Delete(url string, header et.Json) (*Body, Status)

* * Delete * @param url string, header et.Json * @return *Body, Status *

func DeleteWithTls added in v0.1.19

func DeleteWithTls(url string, header et.Json, tlsConfig *tls.Config) (*Body, Status)

* * DeleteWithTls * @param url string, header et.Json, tlsConfig *tls.Config * @return *Body, Status *

func Device added in v1.0.12

func Device(r *http.Request) string

* * Device * @param r *http.Request * @return string *

func Fetch added in v0.1.17

func Fetch(method, url string, header, body et.Json) (*Body, Status)

* * Fetch * @param method, url string, header, body et.Json * @return *Body, Status *

func Get

func Get(url string, header et.Json) (*Body, Status)

* * Get * @param url string, header et.Json * @return *Body, Status *

func GetWithTls added in v0.1.19

func GetWithTls(url string, header et.Json, tlsConfig *tls.Config) (*Body, Status)

* * GetWithTls * @param url string, header et.Json, tlsConfig *tls.Config * @return *Body, Status *

func Http added in v0.1.19

func Http(method, url string, header, body et.Json, tlsConfig *tls.Config) (*Body, Status)

* * Http * @param method, url string, header, body et.Json * @return *Body, Status *

func NewTlsConfig added in v0.1.18

func NewTlsConfig(caFile, certFile, keyFile string) (*tls.Config, error)

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

func Options

func Options(url string, header et.Json) (*Body, Status)

* * Options * @param url string, header et.Json * @return *Body, Status *

func OptionsWithTls added in v0.1.19

func OptionsWithTls(url string, header et.Json, tlsConfig *tls.Config) (*Body, Status)

* * OptionsWithTls * @param url string, header et.Json, tlsConfig *tls.Config * @return *Body, Status *

func Patch

func Patch(url string, header, body et.Json) (*Body, Status)

* * Patch * @param url string, header, body et.Json * @return *Body, Status *

func PatchWithTls added in v0.1.19

func PatchWithTls(url string, header, body et.Json, tlsConfig *tls.Config) (*Body, Status)

* * PatchWithCA * @param url string, header, body et.Json, tlsConfig *tls.Config * @return *Body, Status *

func Payload added in v1.0.12

func Payload(r *http.Request) et.Json

* * Payload * @param r *http.Request * @return et.Json *

func Post

func Post(url string, header, body et.Json) (*Body, Status)

* * Post * @param url string, header, body et.Json * @return *Body, Status *

func PostWithTls added in v0.1.19

func PostWithTls(url string, header, body et.Json, tlsConfig *tls.Config) (*Body, Status)

* * PostWithTls * @param url string, header, body et.Json, tlsConfig *tls.Config * @return *Body, Status *

func Put

func Put(url string, header, body et.Json) (*Body, Status)

* * Put * @param url string, header, body et.Json * @return *Body, Status *

func PutWithTls added in v0.1.19

func PutWithTls(url string, header, body et.Json, tlsConfig *tls.Config) (*Body, Status)

* * PutWithTls * @param url string, header, body et.Json, tlsConfig *tls.Config * @return *Body, Status *

func ServiceId added in v1.0.12

func ServiceId(r *http.Request) string

* * ServiceId * @param r *http.Request * @return string *

func Username added in v1.0.12

func Username(r *http.Request) string

* * Username * @param r *http.Request * @return string *

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, 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) ToItem added in v1.0.11

func (b Body) ToItem() (et.Item, error)

* * ToItem returns an Item object * @return et.Item *

func (Body) ToItems added in v1.0.11

func (b Body) ToItems() (et.Items, error)

* * ToItems returns an Items object * @return et.Items *

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 ContextKey added in v1.0.12

type ContextKey string
const (
	DurationKey  ContextKey = "duration"
	PayloadKey   ContextKey = "payload"
	ServiceIdKey ContextKey = "service_id"
	AppKey       ContextKey = "app"
	DeviceKey    ContextKey = "device"
	UsernameKey  ContextKey = "username"
)

func (ContextKey) Duration added in v1.0.12

func (s ContextKey) Duration(ctx context.Context, def time.Duration) time.Duration

* * Duration * @param ctx context.Context, def time.Duration * @return time.Duration *

func (ContextKey) Json added in v1.0.12

func (s ContextKey) Json(ctx context.Context, def et.Json) et.Json

* * Json * @param ctx context.Context, def et.Json * @return et.Json *

func (ContextKey) String added in v1.0.12

func (s ContextKey) String(ctx context.Context, def string) string

* * String * @param ctx context.Context, def string * @return string *

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