urlfetch

package
v0.0.0-...-128afb8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 6

Documentation

Overview

Package urlfetch provides a way for an application to get http.RoundTripper that can make outbound HTTP requests. If used for https:// protocol, will always validate SSL certificates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

Get pulls http.RoundTripper implementation from context or returns nil if it isn't set. Use SetFactory(...) or Set(...) in unit tests to mock the round tripper.

func Set

Set sets the current http.RoundTripper object in the context. Useful for testing with a quick mock. This is just a shorthand SetFactory invocation to set a factory which always returns the same object.

func SetFactory

func SetFactory(c context.Context, f Factory) context.Context

SetFactory sets the function to produce http.RoundTripper instances, as returned by the Get method.

Types

type Factory

type Factory func(context.Context) http.RoundTripper

Factory is the function signature for factory methods compatible with SetFactory.

Jump to

Keyboard shortcuts

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