MCPcopy Index your code
hub / github.com/cloudfoundry/cli / newGETRequest

Method newGETRequest

api/plugin/request.go:7–23  ·  view source on GitHub ↗

newGETRequest returns a constructed HTTP.Request with some defaults. Defaults are applied when Request options are not filled in.

(url string)

Source from the content-addressed store, hash-verified

5// newGETRequest returns a constructed HTTP.Request with some defaults.
6// Defaults are applied when Request options are not filled in.
7func (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}

Callers 2

DownloadPluginMethod · 0.95
GetPluginRepositoryMethod · 0.95

Calls 2

NewRequestMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected