func (r *Reference) executeRequest(method string, body []byte) ([]byte, error) {
	apiUrl := r.url + r.postfix
	v := url.Values{}
	if r.token != "" {
		v.Set("auth", r.token)
	}
	if r.export == true {
		v.Set("format", "export")
	}
	q := v.Encode()
	if len(q) > 0 {
		apiUrl = apiUrl + "?" + q
	}
	time.Sleep(10 * time.Millisecond)
	req, err := http.NewRequest(method, apiUrl, bytes.NewReader(body))
	if err != nil {
		return nil, err
	}
	if r.response, err = r.client.Do(req); err != nil {
		return nil, err
	}
	if strings.HasPrefix(r.response.Status, "307 ") {
		r.response.Body.Close()  
		location := r.response.Header.Get("Location")
		req, err = http.NewRequest(method, location, bytes.NewReader(body))
		if r.response, err = r.client.Do(req); err != nil {
			return nil, err
		}
	}
	defer r.response.Body.Close()
	status := r.response.Status
	if strings.HasPrefix(status, "2") == false {
		return nil, errors.New(status)
	}
	if r.responseBody, err = ioutil.ReadAll(r.response.Body); err != nil {
		return nil, err
	}
	return r.responseBody, nil
}
Execute a new HTTP Request.
package firebase
import (
	"bytes"
	"encoding/json"
	"errors"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"time"
)
type client interface {
	Do(req *http.Request) (resp *http.Response, err error)
}
type Reference struct {
	url          string
	postfix      string
	client       client
	token        string
	export       bool
	response     *http.Response
	responseBody []byte
}
func NewReference(url string) *Reference {
	r := &Reference{
		url:     url,
		postfix: ".json",
		export:  false,
		client:  &http.Client{},
	}
	return r
}
func (r *Reference) Auth(token string) *Reference {
	r.token = token
	return r
}
func (r *Reference) Export(toggle bool) *Reference {
	r.export = toggle
	return r
}