sgc7http

package
v0.9.53 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPGet

func HTTPGet(url string, header map[string]string) (int, []byte, error)

HTTPGet - get

func HTTPPost

func HTTPPost(url string, header map[string]string, bodyObj interface{}) (int, []byte, error)

HTTPPost - post

func HTTPPostEx

func HTTPPostEx(url string, header map[string]string, body []byte) (int, []byte, error)

HTTPPostEx - post

Types

type APIHandle

type APIHandle func(ctx *fasthttp.RequestCtx, serv *Serv)

APIHandle - handle

type Serv

type Serv struct {
	// contains filtered or unexported fields
}

Serv -

func NewServ

func NewServ(bindAddr string, isDebugMode bool) *Serv

NewServ - new a serv

func (*Serv) HandleFastHTTP

func (s *Serv) HandleFastHTTP(ctx *fasthttp.RequestCtx)

HandleFastHTTP -

func (*Serv) ParseBody

func (s *Serv) ParseBody(ctx *fasthttp.RequestCtx, params interface{}) error

ParseBody - parse body

func (*Serv) RegHandle

func (s *Serv) RegHandle(name string, handle APIHandle)

RegHandle - register a handle

func (*Serv) SetHTTPStatus

func (s *Serv) SetHTTPStatus(ctx *fasthttp.RequestCtx, statusCode int)

SetHTTPStatus - set a response with status

func (*Serv) SetPBResponse

func (s *Serv) SetPBResponse(ctx *fasthttp.RequestCtx, msg proto.Message)

SetResponse - set a response

func (*Serv) SetResponse

func (s *Serv) SetResponse(ctx *fasthttp.RequestCtx, jsonObj interface{})

SetResponse - set a response

func (*Serv) SetStringResponse

func (s *Serv) SetStringResponse(ctx *fasthttp.RequestCtx, str string)

SetStringResponse - set a response with string

func (*Serv) Start

func (s *Serv) Start() error

Start - start a server

func (*Serv) Stop

func (s *Serv) Stop() error

Stop - stop a server

Jump to

Keyboard shortcuts

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