httputil

package
v0.0.0-...-55358d4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package httputil provides HTTP utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileServer

type FileServer struct {
	// contains filtered or unexported fields
}

FileServer serves static files.

func NewFileServer

func NewFileServer(fsys fs.FS) *FileServer

NewFileServer returns a new FileServer which serves files from the given filesystem.

func (*FileServer) FileHandler

func (s *FileServer) FileHandler(filename string) http.Handler

FileHandler returns a handler that serves a single file. The file is specified by a slash separated path relative to the static server's filesystem.

func (*FileServer) QueryParam

func (s *FileServer) QueryParam(filename string) string

QueryParam returns the hash for the given filename as a query parameter.

type ResponseBuffer

type ResponseBuffer struct {
	// contains filtered or unexported fields
}

ResponseBuffer is the current response being composed by its owner. It implements http.ResponseWriter and io.WriterTo.

func (*ResponseBuffer) Header

func (rb *ResponseBuffer) Header() http.Header

Header implements the http.ResponseWriter interface.

func (*ResponseBuffer) Write

func (rb *ResponseBuffer) Write(p []byte) (int, error)

Write implements the http.ResponseWriter interface.

func (*ResponseBuffer) WriteHeader

func (rb *ResponseBuffer) WriteHeader(status int)

WriteHeader implements the http.ResponseWriter interface.

func (*ResponseBuffer) WriteTo

func (rb *ResponseBuffer) WriteTo(w http.ResponseWriter) error

WriteTo implements the io.WriterTo interface.

Jump to

Keyboard shortcuts

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