English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The urlfetch package

## Introduction

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

## Variables

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.

ErrTruncatedBody is only returned once. Subsequent reads will return os.EOF.

    var ErrTruncatedBody = os.NewError("urlfetch: truncated body")

## Functions

func Client

  `func Client(context appengine.Context) *http.Client`

  Client returns an *http.Client using a default urlfetch Transport.

## Types

type Transport

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.

      type Transport struct {
          Context                       appengine.Context
          DeadlineSeconds               float64 // zero means App Engine's default
          AllowInvalidServerCertificate bool
      }

  func (*Transport) RoundTrip

    `func (t *Transport) RoundTrip(req *http.Request) (res *http.Response, err os.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.