github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/plugin/request.go (about)

     1  package plugin
     2  
     3  import "net/http"
     4  
     5  // newGETRequest returns a constructed HTTP.Request with some defaults.
     6  // Defaults are applied when Request options are not filled in.
     7  func (client *Client) newGETRequest(url string) (*http.Request, error) {
     8  	request, err := http.NewRequest(
     9  		http.MethodGet,
    10  		url,
    11  		nil,
    12  	)
    13  	if err != nil {
    14  		return nil, err
    15  	}
    16  
    17  	request.Header = http.Header{}
    18  	request.Header.Set("Accept", "application/json")
    19  	request.Header.Set("Content-Type", "application/json")
    20  	request.Header.Set("User-Agent", client.userAgent)
    21  
    22  	return request, nil
    23  }