teapot

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 5 Imported by: 1

README

Teapot module for Caddy v2

Package teapot implements a sample Caddy v2 module. Its only purpose is to respond with 418 I'm a teapot to every request.

The simplest use could be in a Caddyfile like:

localhost

route {
    teapot
}

Then, when using a Caddy server with this module enabled:

$ curl -I --http1.1 localhost/any/path
HTTP/1.1 418 I'm a teapot
Server: Caddy
Date: Sun, 01 Mar 2020 15:48:23 GMT

(you could, of course use curl --http2, but the reason-phrase I'm a teapot won't display, and that's no fun!)

See also the example/ folder for an example of usage.

Documentation

Overview

Package teapot implements a sample Caddy v2 module. Its only purpose is to respond with "418 I'm a teapot" to every request.

The simplest use could be in a Caddyfile like:

localhost

route {
    teapot
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Teapot

type Teapot struct{}

Teapot implements a static "418 I'm a teapot" response to all requests on the route

func (Teapot) CaddyModule

func (Teapot) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (Teapot) ServeHTTP

func (s Teapot) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error

func (*Teapot) UnmarshalCaddyfile

func (s *Teapot) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile - this is a no-op

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

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