httpsvc

package
v0.0.0-...-ff6a228 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent    = "sailor-agent/1.0.0"
	UserAgentKey = "User-Agent"
	SchemeHTTP   = "http://"
	SchemeHTTPS  = "https://"
)

Variables

Functions

func HandleVersion

func HandleVersion(w http.ResponseWriter, r *http.Request)

VersionHandler - Returns version information @Summary Version handler. @Description Returns version information, like repo, build, runtime, env @Tags version @Accept json @Produce json @Success 200 {string} response "api response" @Router / [get]

func Handler

Handler serverless faas handler.

func RunChi

func RunChi(r *chi.Mux)

func RunTencentChi

func RunTencentChi(r *chi.Mux)

func RunTencentChiWithSwagger

func RunTencentChiWithSwagger(r *chi.Mux, project string)

func RunTencentGin

func RunTencentGin(r *gin.Engine)

Types

type HTTPAirdbResponse

type HTTPAirdbResponse struct {
	Code    uint        `json:"code"`
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
	Error   interface{} `json:"error,omitempty"`
	Message interface{} `json:"message,omitempty"`
}

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient() *HTTPClient

func (*HTTPClient) DoRequest

func (client *HTTPClient) DoRequest(
	request *http.Request,
	requestInterface RequestInterface,
	responseInterface ResponseInterface,
) error

func (*HTTPClient) Downloader

func (client *HTTPClient) Downloader() (io.ReadCloser, error)

func (*HTTPClient) GetBody

func (client *HTTPClient) GetBody() interface{}

func (*HTTPClient) GetDebug

func (client *HTTPClient) GetDebug() bool

func (*HTTPClient) GetDomain

func (client *HTTPClient) GetDomain() string

func (*HTTPClient) GetEndpoint

func (client *HTTPClient) GetEndpoint() string

func (*HTTPClient) GetHeaders

func (client *HTTPClient) GetHeaders() map[string]string

func (*HTTPClient) GetMethod

func (client *HTTPClient) GetMethod() string

func (*HTTPClient) GetTimeout

func (client *HTTPClient) GetTimeout() int

func (*HTTPClient) GetURL

func (client *HTTPClient) GetURL() string

func (*HTTPClient) GetUserAgent

func (client *HTTPClient) GetUserAgent() string

func (*HTTPClient) GetValues

func (client *HTTPClient) GetValues() url.Values

func (*HTTPClient) HTTPRequest

func (client *HTTPClient) HTTPRequest(requestInterface RequestInterface, responseInterface ResponseInterface) error

func (*HTTPClient) HTTPRequestGet

func (client *HTTPClient) HTTPRequestGet(
	ctx context.Context,
	requestInterface RequestInterface,
	responseInterface ResponseInterface,
) error

func (*HTTPClient) HTTPRequestPost

func (client *HTTPClient) HTTPRequestPost(
	ctx context.Context,
	requestInterface RequestInterface,
	responseInterface ResponseInterface,
) error

func (*HTTPClient) SetBody

func (client *HTTPClient) SetBody(body interface{})

func (*HTTPClient) SetDebug

func (client *HTTPClient) SetDebug()

func (*HTTPClient) SetDomain

func (client *HTTPClient) SetDomain(domain string)

func (*HTTPClient) SetEndpoint

func (client *HTTPClient) SetEndpoint(endpoint string)

func (*HTTPClient) SetHeaders

func (client *HTTPClient) SetHeaders(headers map[string]string)

func (*HTTPClient) SetMethod

func (client *HTTPClient) SetMethod(method string)

func (*HTTPClient) SetTimeout

func (client *HTTPClient) SetTimeout(timeout int)

func (*HTTPClient) SetURL

func (client *HTTPClient) SetURL(url string)

func (*HTTPClient) SetUserAgent

func (client *HTTPClient) SetUserAgent(ua string)

func (*HTTPClient) SetValues

func (client *HTTPClient) SetValues(values url.Values)

type RequestInterface

type RequestInterface interface {
	SetDebug()
	GetDebug() bool

	SetDomain(string)
	GetDomain() string

	SetEndpoint(string)
	GetEndpoint() string

	SetURL(string)
	GetURL() string

	SetMethod(string)
	GetMethod() string

	SetTimeout(int)
	GetTimeout() int

	SetHeaders(headers map[string]string)
	GetHeaders() map[string]string

	SetValues(url.Values)
	GetValues() url.Values

	SetBody(interface{})
	GetBody() interface{}

	SetUserAgent(string)
	GetUserAgent() string
}

type ResponseInterface

type ResponseInterface interface{}

Jump to

Keyboard shortcuts

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