Documentation ¶
Index ¶
- Variables
- func CompressHandler(h http.Handler) http.Handler
- func Decorate(f APIHandler, ds ...Decorator) httprouter.Handle
- func GetTopicArg(rp getter) (string, error)
- func GetTopicChannelArgs(rp getter) (string, string, error)
- func GetTopicPartitionArgs(rp getter) (string, int, error)
- func GetTopicPartitionChannelArgs(rp getter) (string, int, string, error)
- func LogMethodNotAllowedHandler(l *levellogger.LevelLogger) http.Handler
- func LogNotFoundHandler(l *levellogger.LevelLogger) http.Handler
- func LogPanicHandler(l *levellogger.LevelLogger) func(w http.ResponseWriter, req *http.Request, p interface{})
- func NewDeadlineTransport(timeout time.Duration) *http.Transport
- func Respond(w http.ResponseWriter, statusCode int, statusTxt string, data interface{})
- func RespondV1(w http.ResponseWriter, code int, data interface{})
- func Serve(listener net.Listener, handler http.Handler, proto string, ...)
- type APIHandler
- type Client
- type Decorator
- type Err
- type PostParams
- type ReqParams
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDeprecatedAPI = errors.New("deprecated api")
)
Functions ¶
func CompressHandler ¶ added in v0.3.6
CompressHandler gzip compresses HTTP responses for clients that support it via the 'Accept-Encoding' header.
func Decorate ¶ added in v0.3.6
func Decorate(f APIHandler, ds ...Decorator) httprouter.Handle
func GetTopicArg ¶
func GetTopicChannelArgs ¶
func GetTopicPartitionArgs ¶
partition can be missing, default as 0.
func LogMethodNotAllowedHandler ¶ added in v0.3.6
func LogMethodNotAllowedHandler(l *levellogger.LevelLogger) http.Handler
func LogNotFoundHandler ¶ added in v0.3.6
func LogNotFoundHandler(l *levellogger.LevelLogger) http.Handler
func LogPanicHandler ¶ added in v0.3.6
func LogPanicHandler(l *levellogger.LevelLogger) func(w http.ResponseWriter, req *http.Request, p interface{})
func NewDeadlineTransport ¶
A custom http.Transport with support for deadline timeouts
func Respond ¶
func Respond(w http.ResponseWriter, statusCode int, statusTxt string, data interface{})
func RespondV1 ¶
func RespondV1(w http.ResponseWriter, code int, data interface{})
Types ¶
type APIHandler ¶ added in v0.3.6
type APIHandler func(http.ResponseWriter, *http.Request, httprouter.Params) (interface{}, error)
func DeprecatedAPI ¶
func DeprecatedAPI(f APIHandler) APIHandler
func NegotiateVersion ¶ added in v0.3.6
func NegotiateVersion(f APIHandler) APIHandler
func PlainText ¶ added in v0.3.6
func PlainText(f APIHandler) APIHandler
func V1 ¶ added in v0.3.6
func V1(f APIHandler) APIHandler
func V1Stream ¶
func V1Stream(f APIHandler) APIHandler
type Client ¶ added in v0.3.6
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GETV1 ¶ added in v0.3.6
GETV1 is a helper function to perform a V1 HTTP request and parse our NSQ daemon's expected response format, with deadlines.
func (*Client) NegotiateV1 ¶ added in v0.3.6
NegotiateV1 is a helper function to perform a v1 HTTP request and fallback to parsing the old backwards-compatible response format storing the result in the value pointed to by v.
TODO: deprecated, remove in 1.0 (replace calls with GETV1)
type Decorator ¶ added in v0.3.6
type Decorator func(APIHandler) APIHandler
func DebugLog ¶
func DebugLog(l *levellogger.LevelLogger) Decorator
func Log ¶ added in v0.3.6
func Log(l *levellogger.LevelLogger) Decorator
type PostParams ¶
Click to show internal directories.
Click to hide internal directories.