MCPcopy Create free account
hub / github.com/docker/cli / postForm

Function postForm

internal/oauth/api/api.go:214–225  ·  view source on GitHub ↗
(ctx context.Context, reqURL string, data io.Reader)

Source from the content-addressed store, hash-verified

212}
213
214func postForm(ctx context.Context, reqURL string, data io.Reader) (*http.Response, error) {
215 req, err := http.NewRequestWithContext(ctx, http.MethodPost, reqURL, data)
216 if err != nil {
217 return nil, err
218 }
219
220 req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
221 cliVersion := strings.ReplaceAll(version.Version, ".", "_")
222 req.Header.Set("User-Agent", fmt.Sprintf("docker-cli:%s:%s-%s", cliVersion, runtime.GOOS, runtime.GOARCH))
223
224 return http.DefaultClient.Do(req)
225}
226
227func (API) GetAutoPAT(ctx context.Context, audience string, res TokenResponse) (string, error) {
228 patURL := audience + "/v2/access-tokens/desktop-generate"

Callers 3

GetDeviceCodeMethod · 0.85
getDeviceTokenMethod · 0.85
RevokeTokenMethod · 0.85

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…