httpx

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package httpx implements helper function for HTTP requests.

Index

Constants

View Source
const JSONContentType = "application/json"

JSONContentType represents MIME type for JSON content.

Variables

View Source
var DefaultHealthPath = "/health"

DefaultHealthPath is the default HTTP path for checking health.

Functions

func JSON

func JSON(w http.ResponseWriter, code int, v interface{}) error

JSON encodes json content to the ResponseWriter.

func NewHealthHandler

func NewHealthHandler(v ...Health) http.HandlerFunc

NewHealthHandler returns a handler for application health checking.

func RealIP

func RealIP(r *http.Request) string

RealIP resolves the real client IP address from the request.

Types

type Health

type Health interface {
	IsHealthy() error
}

Health represents an object that can check its health.

Directories

Path Synopsis
Package middleware implements reusable HTTP middleware.
Package middleware implements reusable HTTP middleware.

Jump to

Keyboard shortcuts

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