flexwork

package module
v0.0.0-...-5dd4c9b Latest Latest
Warning

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

Go to latest
Published: May 21, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

README

flexwork

GoDoc

A flexible set of packages for building and implementing net/http handlers.

See the Godoc for details.

Documentation

Overview

Package flexwork contains utility functionality for writing HTTP handlers and building HTTP servers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, code int, fmtStr string, vars ...interface{})

Error is a convenience function for http.Error, but it allows you to specify the error string in a format string

func MatchHost

func MatchHost(handlers map[string]http.Handler) http.Handler

MatchHost creates a handler that invokes the appropriate handler for the incoming request's Host header, according to handlers. It looks for exact host values (no regexes) in handlers

func MatchesMethod

func MatchesMethod(r *http.Request, m Method) bool

MatchesMethod returns whether or not the method in r is the same as m

func MethodMux

func MethodMux(m map[Method]http.Handler) http.Handler

MethodMux returns an http.Handler that routes to the correct handler based on the request method as defined in m

Types

type Method

type Method string

Method is the type for the incoming HTTP Method

const (
	// Get is the constant for the HTTP GET method
	Get Method = "GET"
	// Post is the constant for the HTTP POST method
	Post Method = "POST"
	// Put is the constant for the HTTP PUT method
	Put Method = "PUT"
	// Delete is the constant for the HTTP DELETE method
	Delete Method = "DELETE"
	// Head is the constant for the HTTP HEAD method
	Head Method = "HEAD"
	// Options is the constant for the HTTP OPTIONS method
	Options Method = "OPTIONS"
)

func (Method) String

func (m Method) String() string

String is the fmt.Stringer interface implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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