etagResponseWriter

package
v1.0.0-...-4f7f1ef Latest Latest
Warning

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

Go to latest
Published: May 31, 2016 License: LGPL-3.0 Imports: 4 Imported by: 0

README

martini etag http header response middleware

Usage

package main

import (
	"github.com/go-martini/martini"
	"github.com/tsaikd/KDGoLib/martini/etagResponseWriter"
)

func main() {
	m := martini.Classic()
	m.Use(etagResponseWriter.ETagResponseWriter(etagResponseWriter.NewETagConfig()))
	m.Get("/", func() string {
		return "Hello World!"
	})
	m.Run()
}

Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETagResponseWriter

func ETagResponseWriter(config *ETagConfig) martini.Handler

Types

type ETagConfig

type ETagConfig struct {
	MinBodyLength       int
	EnableMethod        map[string]bool
	EnableStatus        map[int]bool
	IgnoreIfHeaderExist map[string]bool
	IgnoreIfHeaderValue map[string]string
	HashFunc            ETagHashFunc
}

func NewETagConfig

func NewETagConfig() *ETagConfig

func (*ETagConfig) AddIgnoreHeaderExist

func (t *ETagConfig) AddIgnoreHeaderExist(header string, exist bool) *ETagConfig

func (*ETagConfig) AddIgnoreHeaderValue

func (t *ETagConfig) AddIgnoreHeaderValue(header string, value string) *ETagConfig

func (*ETagConfig) AddMethod

func (t *ETagConfig) AddMethod(method string) *ETagConfig

func (*ETagConfig) AddStatus

func (t *ETagConfig) AddStatus(status int) *ETagConfig

func (*ETagConfig) SetHashFunc

func (t *ETagConfig) SetHashFunc(hashFunc ETagHashFunc) *ETagConfig

func (*ETagConfig) SetMinBodyLength

func (t *ETagConfig) SetMinBodyLength(length int) *ETagConfig

type ETagHashFunc

type ETagHashFunc func(data []byte) string

Jump to

Keyboard shortcuts

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