httpx

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package httpx provides some functions about http.

Index

Constants

This section is empty.

Variables

View Source
var DefaultFilterededHeaders = []string{"Host", "Connection"}

DefaultFilterededHeaders is the filtered headers.

Functions

func HandleResponse

func HandleResponse(w http.ResponseWriter, resp *http.Response, cb func(http.ResponseWriter)) error

HandleResponse copies the response header and body to w.

cb will be called after copying the response header.

func HandleResponseBody

func HandleResponseBody(w http.ResponseWriter, resp *http.Response) error

HandleResponseBody copies the response body, not contain header, to w.

Types

type Config

type Config struct {
	Host   string // Required
	Port   uint16 // Required
	Weight int    // Optional, Default: 1
}

Config is used to configure and new a http endpoint.

func (Config) ID

func (c Config) ID() string

func (Config) NewEndpoint

func (c Config) NewEndpoint() *endpoint.Endpoint

NewEndpoint returns a new simple endpoint.

For the argument request, it may be one of types:

*http.Request
interface{ Request() *http.Request }

Jump to

Keyboard shortcuts

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