goji: github.com/zenazn/goji/web/mutil Index | Files

package mutil

import "github.com/zenazn/goji/web/mutil"

Package mutil contains various functions that are helpful when writing http middleware.

Index

Package Files

mutil.go writer_proxy_go1_8.go

type WriterProxy Uses

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 Uses

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.

Package mutil imports 4 packages (graph) and is imported by 72 packages. Updated 2019-06-02. Refresh now. Tools for package owners.