gae: go.chromium.org/gae/service/urlfetch Index | Files

package urlfetch

import "go.chromium.org/gae/service/urlfetch"

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

Package Files

context.go

func Get Uses

func Get(c context.Context) http.RoundTripper

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

func Set Uses

func Set(c context.Context, r http.RoundTripper) context.Context

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 Uses

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

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

type Factory Uses

type Factory func(context.Context) http.RoundTripper

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

Package urlfetch imports 3 packages (graph) and is imported by 9 packages. Updated 2018-09-25. Refresh now. Tools for package owners.