client

package
Version: v0.0.0-...-a94aad2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package client provides utilities to create easily new http.Client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) (*http.Client, error)

New returns a new *http.Client or an error after applying the received Options.

Types

type Option

type Option func(c *http.Client) error

Option defines an option for a new *http.Client.

func WithProxy

func WithProxy(proxy string) Option

WithProxy receives a proxy's URL and returns an Option function that parses that URL and, if there is no errors, creates a new http.Transport configured that is applied to a new *http.Client.

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout receives a timeout and returns an Option that applies it to a new *http.Client.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL