status

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package status is middleware for returning status code for requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	// Base path. Request to this path and sub-paths will be answered with StatusCode
	Base string

	// Status code to return
	StatusCode int

	// Request matcher
	httpserver.RequestMatcher
}

Rule describes status rewriting rule

func NewRule

func NewRule(basePath string, status int) *Rule

NewRule creates new Rule.

func (*Rule) BasePath

func (rule *Rule) BasePath() string

BasePath implements httpserver.HandlerConfig interface

type Status

type Status struct {
	Rules []httpserver.HandlerConfig
	Next  httpserver.Handler
}

Status is a middleware to return status code for request

func (Status) ServeHTTP

func (status Status) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP implements the httpserver.Handler interface

Jump to

Keyboard shortcuts

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