http

package
v0.0.0-...-2080a7e Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileInfoFasterFunc = files.FileInfoFaster

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs each request and its status code.

func StartHttp

func StartHttp(ctx context.Context, s storage.Store, shutdownComplete chan struct{})

Types

type FileCache

type FileCache interface {
	Store(ctx context.Context, key string, value []byte) error
	Load(ctx context.Context, key string) ([]byte, bool, error)
	Delete(ctx context.Context, key string) error
}

type HttpResponse

type HttpResponse struct {
	Status  int    `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
	Token   string `json:"token,omitempty"`
}

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	http.ResponseWriter
	StatusCode int

	PayloadSize int
	User        string
	// contains filtered or unexported fields
}

ResponseWriterWrapper wraps the standard http.ResponseWriter to capture the status code

func (*ResponseWriterWrapper) Flush

func (w *ResponseWriterWrapper) Flush()

func (*ResponseWriterWrapper) Write

func (w *ResponseWriterWrapper) Write(b []byte) (int, error)

Write is the method to write the response body and ensure WriteHeader is called

func (*ResponseWriterWrapper) WriteHeader

func (w *ResponseWriterWrapper) WriteHeader(statusCode int)

WriteHeader captures the status code and ensures it's only written once

type TemplateRenderer

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

func (*TemplateRenderer) Render

func (t *TemplateRenderer) Render(w http.ResponseWriter, name string, data interface{}) error

Render renders a template document with headers and data

type UserRequest

type UserRequest struct {
	Which []string   `json:"which"`
	User  users.User `json:"data"`
}

Jump to

Keyboard shortcuts

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