httplib

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentJS    = "application/javascript"
	ContentOGG   = "application/ogg"
	ContentPDF   = "application/pdf"
	ContentXHTML = "application/xhtml+xml"
	ContentJSON  = "application/json"
	ContentXML   = "application/xml"
	ContentZIP   = "application/zip"
)

Variables

This section is empty.

Functions

func GetBool

func GetBool(p string, r *http.Request) bool

func GetFloat

func GetFloat(p string, r *http.Request) float64

func GetInt

func GetInt(p string, r *http.Request) int

func GetParameterBool

func GetParameterBool(p string, r *http.Request) bool

func GetParameterFloat

func GetParameterFloat(p string, r *http.Request) float64

func GetParameterInt

func GetParameterInt(p string, r *http.Request) int

func GetParameterString

func GetParameterString(p string, r *http.Request) string

func GetString

func GetString(p string, r *http.Request) string

func ParseBody

func ParseBody(r *http.Request, body *interface{}) error

func ReadBody

func ReadBody(r *http.Request) (body []byte, err error)

func Send

func Send(w http.ResponseWriter, body interface{})

func SendError

func SendError(w http.ResponseWriter, err error)

Types

type Header struct {
	Key   string
	Value string
}

type Parameter

type Parameter struct {
	Key   string
	Value interface{}
}

type Request

type Request struct {
	Method      string
	URL         string
	ContentType string
	Headers     []Header
	Parameter   []Parameter
	Body        []byte
	Status      int
}

func (*Request) Send

func (r *Request) Send(ctx context.Context) (response []byte, err error)

func (*Request) SendWithoutContext

func (r *Request) SendWithoutContext() (response []byte, err error)

type Response

type Response struct {
	Success   bool        `json:"Success"`
	Data      interface{} `json:"Data"`
	Message   string      `json:"Message,omitempty"`
	ErrorCode int         `json:"ErrorCode,omitempty"`
}

Jump to

Keyboard shortcuts

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