// NewTestHTTPSession constructs a new TestHTTPSession. The session will // instantiate a client using the based base context. All HTTP requests from the // session will be sent to the given baseUrl. // // baseUrl should be specified *without* a request scheme (i.e. "http://"); the // request scheme will be used from the context. // // If an error occurs in HTTP layer during any session operation, a Fatal method // will be called on the supplied t.Tester. func NewTestHTTPSession(t util.Tester, ctx *base.Context, baseURL string) *TestHTTPSession { client, err := ctx.GetHTTPClient() if err != nil { t.Fatalf("error creating client: %s", err) } return &TestHTTPSession{ t: t, client: client, baseURL: ctx.RequestScheme() + "://" + baseURL, } }