httputils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthInfoHandler

func AuthInfoHandler(w http.ResponseWriter, r *http.Request) []byte

AuthInfoHandler reads authentication info provided by the Endpoints proxy.

func DecodeJSONBody added in v0.0.2

func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) error

DecodeJSONBody in http request

func SendCode

func SendCode(w http.ResponseWriter, code int)

SendCode response

func SendData

func SendData(w http.ResponseWriter, code int, resp *Response)

SendData response

func SendError

func SendError(w http.ResponseWriter, code int)

SendError response

Types

type Metadatas

type Metadatas struct {
	TotalIndex     int `json:"total_index"`
	FirstIndexPage int `json:"first_index_page,omitempty"`
	LastIndexPage  int `json:"last_index_page,omitempty"`
}

Metadatas struct

type Pagination

type Pagination struct {
	PerPage int
	Page    int
	Limits  map[string]int
}

Pagination struct

func URLQuery

func URLQuery(queries url.Values) (map[string][]string, Pagination)

URLQuery HTTP

type Response

type Response struct {
	RequestID string      `json:"request_id,omitempty"`
	Message   string      `json:"message,omitempty"`
	Results   interface{} `json:"results,omitempty"`
	Metadatas *Metadatas  `json:"metadatas,omitempty"`
}

Response HTTP

func DataQuery

func DataQuery(tmpData []interface{}, pages Pagination) *Response

DataQuery informations

Jump to

Keyboard shortcuts

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