handlers

package
v0.0.0-...-d2e4435 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContentType = "text/csv"

DefaultContentType is the output content type if no other is found on the request

Variables

This section is empty.

Functions

func ExtractContentType

func ExtractContentType(req *http.Request) (contentType string)

ExtractContentType gets the client's preferred response type from the request. Treats the order of content types in the header as the preference (i.e. it ignores preferences defined as "q" values).

func ExtractLang

func ExtractLang(req *http.Request) (lang string, accept string, param string)

ExtractLang pulls the best possible language out of a request.

func GetQueryParam

func GetQueryParam(req *http.Request, paramName string) string

GetQueryParam gets the first (if any) value from the query string with the given param name.

Types

type StringHandler

type StringHandler struct {
	ST *loader.StringTable
}

StringHandler handles a request for an individual string.

func (StringHandler) ServeHTTP

func (h StringHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

type StringsHandler

type StringsHandler struct {
	ST *loader.StringTable
}

StringsHandler handles a request for a full string catalog by language.

func (StringsHandler) ServeHTTP

func (h StringsHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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