httpok

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 7 Imported by: 1

README

Candango HttpOK

Welcome to the world of httpok, your Go library for extending the capabilities of the standard net/http package!

Installation

To get httpok, you can use go get:

go get github.com/candango/httpok

Support

HttpOK is one of Candango Open Source Group initiatives. Available under the MIT License.

This site and all documentation are licensed under Creative Commons 3.0.

Copyright © 2024 Flavio Garcia

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GracefulServer added in v0.0.3

type GracefulServer struct {
	Name string
	*http.Server
	context.Context
	logger.Logger
	SessionEngine session.Engine
}

GracefulServer combines an HTTP server with a context for graceful shutdown handling.

func NewGracefulServer added in v0.0.6

func NewGracefulServer(s *http.Server) *GracefulServer

func (*GracefulServer) Run added in v0.0.3

func (s *GracefulServer) Run(sig ...os.Signal) chan os.Signal

Run starts the HTTP server in a goroutine and listens for termination signals to gracefully shut down. It takes optional signals to listen for; if none are provided, it uses default signals.

type WrappedWriter added in v0.0.2

type WrappedWriter struct {
	http.ResponseWriter
	StatusCode int
}

WrappedWriter wraps an http.ResponseWriter to capture the status code of the response.

func (*WrappedWriter) WriteHeader added in v0.0.2

func (w *WrappedWriter) WriteHeader(c int)

WriteHeader records the status code and then calls the underlying WriteHeader method. This allows tracking of the response status without altering how the original ResponseWriter behaves.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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