util

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrainBody

func DrainBody(b io.ReadCloser) (rb []byte, nopb io.ReadCloser, err error)

DrainBody reads all of b to memory and then returns bytes of b and a ReadCloser yielding the same bytes.

It returns an error if the initial slurp of all bytes fails. It does not attempt to make the returned ReadCloser have identical error-matching behavior.

func ResetBody

func ResetBody(req *http.Request, b []byte)

func ResolveReferenceURL

func ResolveReferenceURL(base, ref string) (*url.URL, error)

ResolveReferenceURL resolves a URI reference to an absolute URI from an absolute base URI u, per RFC 3986 Section 5.2. The URI reference may be relative or absolute. ResolveReferenceURL always returns a new URL instance, even if the returned URL is identical to either the base or reference. If ref is an absolute URL, then ResolveReferenceURL ignores base and returns a copy of ref.

func ToString

func ToString(v interface{}) string

ToString convert v to string

Types

This section is empty.

Jump to

Keyboard shortcuts

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