http

package
v0.0.0-...-ae36b9e Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Copied from https://github.com/zenazn/goji/blob/master/web/mutil/writer_proxy_go1_8.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(addr string, db *sql.DB, todoRepo repository.TodoRepository, logger *zap.Logger) *server

NewServer creates HTTP server for backend

Types

type CreateTodoRequestValidation

type CreateTodoRequestValidation struct {
	Title string `validate:"required,min=1,max=50"`
}

type UpdateTodoRequestValidation

type UpdateTodoRequestValidation struct {
	Id    string `validate:"required"`
	Title string `validate:"required,min=1,max=50"`
}

type WriterProxy

type WriterProxy interface {
	http.ResponseWriter
	// Status returns the HTTP status of the request, or 0 if one has not
	// yet been sent.
	Status() int
	// BytesWritten returns the total number of bytes sent to the client.
	BytesWritten() int
	// Tee causes the response body to be written to the given io.Writer in
	// addition to proxying the writes through. Only one io.Writer can be
	// tee'd to at once: setting a second one will overwrite the first.
	// Writes will be sent to the proxy before being written to this
	// io.Writer. It is illegal for the tee'd writer to be modified
	// concurrently with writes.
	Tee(io.Writer)
	// Unwrap returns the original proxied target.
	Unwrap() http.ResponseWriter
}

WriterProxy is a proxy around an http.ResponseWriter that allows you to hook into various parts of the response process.

func WrapWriter

func WrapWriter(w http.ResponseWriter) WriterProxy

WrapWriter wraps an http.ResponseWriter, returning a proxy that allows you to hook into various parts of the response process.

Jump to

Keyboard shortcuts

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