nfasthttp

package
v0.0.0-...-7fa2d53 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET    = "GET"
	POST   = "POST"
	PUT    = "PUT"
	DELETE = "DELETE"
)

Variables

View Source
var ErrClientBadRequest = errors.New("bad request") // Final status

Clients replies

View Source
var ErrClientUnavailable = errors.New("client unavailable") // Temporary status -> repeat routing

Functions

func ResponseFail

func ResponseFail(ctx *fasthttp.RequestCtx, statusCode int, data []byte)

func ResponseFailDefault

func ResponseFailDefault(ctx *fasthttp.RequestCtx, statusCode int, msg string)

func ResponseSuccess

func ResponseSuccess(ctx *fasthttp.RequestCtx, statusCode int, data []byte)

func ResponseSuccessDefault

func ResponseSuccessDefault(ctx *fasthttp.RequestCtx, statusCode int, msg string)

func ResponseSuccessOK

func ResponseSuccessOK(ctx *fasthttp.RequestCtx, data []byte)

func ResponseSuccessOKDefault

func ResponseSuccessOKDefault(ctx *fasthttp.RequestCtx, msg string)

Types

type Client

type Client struct {
	URL  string
	Port int
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(url string, port int) *Client

func (*Client) CreateURI

func (c *Client) CreateURI(cmd string) string

Генерация URI

func (*Client) Init

func (c *Client) Init(url string, port int)

func (*Client) Release

func (c *Client) Release()

func (*Client) Response

func (c *Client) Response() *fasthttp.Response

func (*Client) SendRequest

func (c *Client) SendRequest(reqUri string, method string, dataReq interface{}) error

Отправка POST запроса

type StandardResponse

type StandardResponse struct {
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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