httputil

package
v0.0.0-...-db3ccfa Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package httputil provides HTTP utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptEncoding

func AcceptEncoding(h http.Header, encoding string) bool

AcceptEncoding returns true if h contains encoding in an Accept-Encoding HTTP header.

func ExtractOpenGraphImage

func ExtractOpenGraphImage(r io.Reader) (string, error)

ExtractOpenGraphImage returns the Open Graph image tag of the HTML document in r.

func ExtractOpenGraphTitle

func ExtractOpenGraphTitle(r io.Reader) (string, error)

ExtractOGTItle returns the Open Graph title tag found in the HTML document in r.

func FileServer

func FileServer(root http.FileSystem) http.Handler

FileServer is like http.FileServer except if name.gz file is found, it's assumed to be gzipped, and is served instead without the .gz suffix (if all appropriate request headers are present).

func Get

func Get(url string) (*http.Response, error)

Get fetches the file at url with an ordinary looking User-Agent. Make sure to close the http.Response.Body.

func GetIP

func GetIP(r *http.Request) string

GetIP returns the IP address associated with r.

func GzipHandler

func GzipHandler(h http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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