// -----------------------------------------------------------------------------
// Makes an http GET request and returns the byte array contents
499266
func makeReq(url string) ([]byte, error) {
  response, err := http.Get(url)
  if err != nil {
    fmt.Printf("%s", err)
    return nil, Error(fmt.Sprintf("%s", err))
  } else {
    defer response.Body.Close()
    contents, err := ioutil.ReadAll(response.Body)
    if err != nil {
      fmt.Printf("%s", err)
      return nil, Error(fmt.Sprintf("%s", err))
    }
    // fmt.Printf("%s\n", string(contents))
    return contents, nil
  }
}
1360181
func (res *MCResponse) Bytes() []byte {
	data := make([]byte, res.Size())

	pos := res.fillHeaderBytes(data)

	copy(data[pos:pos+len(res.Body)], res.Body)

	return data
}
1280977
func (b Byte) Get() (byte, error) {
	if !b.Present() {
		var zero byte
		return zero, errors.New("value not present")
	}
	return *b.value, nil
}
873847
func wantsCompressedResponse(httpRequest *http.Request) (bool, string) {
	header := httpRequest.Header.Get(HEADER_AcceptEncoding)
	gi := strings.Index(header, ENCODING_GZIP)
	zi := strings.Index(header, ENCODING_DEFLATE)
	// use in order of appearance
	if gi == -1 {
		return zi != -1, ENCODING_DEFLATE
	} else if zi == -1 {
		return gi != -1, ENCODING_GZIP
	} else {
		if gi < zi {
			return true, ENCODING_GZIP
		}
		return true, ENCODING_DEFLATE
	}
}
198964
func (req *request) Encode() (data []byte) {
	l := len(req.Data)        // length of data
	tl := l + minPacketLength // add 12 bytes head
	data = getBuffer(tl)
	copy(data[:4], reqStr)
	binary.BigEndian.PutUint32(data[4:8], req.DataType)
	binary.BigEndian.PutUint32(data[8:12], uint32(l))
	copy(data[minPacketLength:], req.Data)
	return
}
316697
func concatAndGetBytes(arr []string, delim string) []byte {
	cstr := ""
	for _, s := range arr {
		cstr += s
		cstr += delim
	}
	return []byte(cstr)
}
459258
func GetBytesResponse(res *peer.Response) ([]byte, error) {
	resBytes, err := proto.Marshal(res)
	return resBytes, errors.Wrap(err, "error marshaling Response")
}
1126922
func (r *FastHttpHeader) Get(key string) (value []string) {
	if !r.isResponse {
		value = strings.Split(string(r.Source.(*FastHttpRequest).Original.Request.Header.Peek(key)), ",")
	} else {
		value = strings.Split(string(r.Source.(*FastHttpResponse).Original.Response.Header.Peek(key)), ",")
	}
	return
}
883410
func GetRequestBody(r *http.Request) ([]byte, error) {
	body, err := ioutil.ReadAll(r.Body)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return body, nil
}
1123052
func get(url string) ([]byte, string) {
	resp, err := http.Get(url)
	if err != nil {
		log.Fatal("Error getting url.")
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	ct := resp.Header.Get("Content-Type")

	if resp.StatusCode == 200 && len(body) > 512 {
		return body, ct
	}

	if DefaultImage() == "" {
		return []byte(""), ct
	}

	if url == DefaultImage() {
		panic("Catching an infinite loop! Default Image doesn't exist or is broken. Please rectify!")
	}

	return get(DefaultImage())
}
770676
func (conn *Connection) Get(url string) (result []byte, err error) {
	return conn.Query("GET", url)
}
1001614
func GetResponseAndBytes(url string) (*http.Response, []byte, error) {
	resp, err := http.Get(url)
	if err != nil {
		return resp, []byte{}, err
	}
	bytes, err := ResponseBody(resp)
	return resp, bytes, err
}
867294
func (c *FCGIClient) Get(p map[string]string) (resp *http.Response, err error) {

	p["REQUEST_METHOD"] = "GET"
	p["CONTENT_LENGTH"] = "0"

	return c.Request(p, nil)
}
319991
func Get(typ, format string) ([]byte, error) {
	switch typ {
	case "date-only":
		return get("date_only.go")
	case "time-only":
		return get("time_only.go")
	case "datetime-only":
		return get("datetime_only.go")
	case "datetime":
		if format == "" || strings.ToUpper(format) == "RFC3339" {
			return get("datetime.go")
		} else if strings.ToUpper(format) == "RFC2616" {
			return get("datetime_rfc2616.go")
		}
	}
	return []byte{}, fmt.Errorf("unrecognized combination of type :%v format : %v", typ, format)
}
710809
func (l *Client) Get(endpoint string, params url.Values, body interface{}, response, data interface{}) error {
	method := "GET"

	// get the formatted endpoint url
	path, err := l.PrepUrl(endpoint, params, false)
	if err != nil {
		return err
	}

	payload, err := prepRequestBody(body)
	if err != nil {
		return err
	}

	// build the request
	r, _ := http.NewRequest(method, path, payload)

	// execute the request
	err = l.Do(r, response, data)
	if err != nil {
		return err
	}

	return nil
}
573111
func (c *Client) Get(url string) (*Response, error) {
	req, err := c.NewRequest("GET", url, nil)

	if err != nil {
		return nil, err
	}

	req = c.Config.AddRequestHeader(req)
	response, err := c.Do(req)

	if err != nil {
		return nil, err
	}

	return response, nil
}
1213391
func (r *Response) Bytes() []byte {
	if r.Error != nil {
		return nil
	}

	r.populateResponseByteBuffer()

	// Are we still empty?
	if r.buffer.Len() == 0 {
		return nil
	}
	return r.buffer.Bytes()
}