fresh

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

cod-fresh

Build Status

HTTP response freshness testing middleware for cod.

package main

import (
	"bytes"

	"github.com/vicanso/cod"

	etag "github.com/vicanso/cod-etag"
	fresh "github.com/vicanso/cod-fresh"
)

func main() {

	d := cod.New()
	d.Use(fresh.NewDefault())
	d.Use(etag.NewDefault())

	d.GET("/", func(c *cod.Context) (err error) {
		c.BodyBuffer = bytes.NewBufferString("abcd")
		return
	})

	d.ListenAndServe(":7001")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) cod.Handler

New create a fresh checker

func NewDefault

func NewDefault() cod.Handler

NewDefault create a default ETag middleware

Types

type Config

type Config struct {
	Skipper cod.Skipper
}

Config fresh config

Jump to

Keyboard shortcuts

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