func (doer httpRequestDoer) Do(req *http.Request) (*http.Response, error) {
	if err := authHTTPRequest(
		req,
		doer.st.tag,
		doer.st.password,
		doer.st.nonce,
		doer.st.macaroons,
	); err != nil {
		return nil, errors.Trace(err)
	}
	return doer.st.bakeryClient.DoWithCustomError(req, func(resp *http.Response) error {
		// At this point we are only interested in errors that
		// the bakery cares about, and the CodeDischargeRequired
		// error is the only one, and that always comes with a
		// response code StatusUnauthorized.
		if resp.StatusCode != http.StatusUnauthorized {
			return nil
		}
		return bakeryError(unmarshalHTTPErrorResponse(resp))
	})
}
// Do implements httprequest.Doer.Do.
Do implements httprequest.Doer.Do.
// Do implements httprequest . Doer . Do .
func (doer httpRequestDoer) Do(req *http.Request) (*http.Response, error) {
	if err := authHTTPRequest(
		req,
		doer.st.tag,
		doer.st.password,
		doer.st.nonce,
		doer.st.macaroons,
	); err != nil {
		return nil, errors.Trace(err)
	}
	return doer.st.bakeryClient.DoWithCustomError(req, func(resp *http.Response) error {
		if resp.StatusCode != http.StatusUnauthorized {
			return nil
		}
		return bakeryError(unmarshalHTTPErrorResponse(resp))
	})
}
func ( doer httpRequestDoer ) Do ( req * http . Request ) ( * http . Response , error ) { if err := authHTTPRequest ( req , doer . st . tag , doer . st . password , doer . st . nonce , doer . st . macaroons , ) ; err != nil { return nil , errors . Trace ( err ) } return doer . st . bakeryClient . DoWithCustomError ( req , func ( resp * http . Response ) error { if resp . StatusCode != http . StatusUnauthorized { return nil } return bakeryError ( unmarshalHTTPErrorResponse ( resp ) ) } ) }
Do implements httprequest.Doer.Do.
Do implements httprequest . Doer . Do .
// At this point we are only interested in errors that // the bakery cares about, and the CodeDischargeRequired // error is the only one, and that always comes with a // response code StatusUnauthorized.