urlfetch

package
v0.20.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2016 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package urlfetch provides an http.RoundTripper implementation for fetching URLs via App Engine's urlfetch service.

Index

Constants

This section is empty.

Variables

View Source
var ErrTruncatedBody = errors.New("urlfetch: truncated body")

ErrTruncatedBody is the error returned after the final Read() from a response's Body if the body has been truncated by App Engine's proxy.

Functions

func Client

func Client(ctx context.Context) *http.Client

Client returns an *http.Client using a default urlfetch Transport. This client will have the default deadline of 5 seconds, and will check the validity of SSL certificates.

Any deadline of the provided context will be used for requests through this client; if the client does not have a deadline then a 5 second default is used.

Types

type Transport

type Transport struct {
	Context context.Context

	// Controls whether the application checks the validity of SSL certificates
	// over HTTPS connections. A value of false (the default) instructs the
	// application to send a request to the server only if the certificate is
	// valid and signed by a trusted certificate authority (CA), and also
	// includes a hostname that matches the certificate. A value of true
	// instructs the application to perform no certificate validation.
	AllowInvalidServerCertificate bool
}

Transport is an implementation of http.RoundTripper for App Engine. Users should generally create an http.Client using this transport and use the Client rather than using this transport directly.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (res *http.Response, err error)

RoundTrip issues a single HTTP request and returns its response. Per the http.RoundTripper interface, RoundTrip only returns an error if there was an unsupported request or the URL Fetch proxy fails. Note that HTTP response codes such as 5xx, 403, 404, etc are not errors as far as the transport is concerned and will be returned with err set to nil.

Jump to

Keyboard shortcuts

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