MCPcopy Create free account
hub / github.com/cli/cli / keyUpload

Function keyUpload

pkg/cmd/ssh-key/add/http.go:106–116  ·  view source on GitHub ↗
(httpClient *http.Client, hostname string, u safeurl.SafeURL, payload map[string]string)

Source from the content-addressed store, hash-verified

104}
105
106func keyUpload(httpClient *http.Client, hostname string, u safeurl.SafeURL, payload map[string]string) error {
107 payloadBytes, err := json.Marshal(payload)
108 if err != nil {
109 return err
110 }
111
112 // TODO(api-client-rollout)
113 // This line of code is part of a mechanical roll out of the api client.
114 // As a follow up, consider whether the api client can be injected to this call site, rather than constructed
115 return api.NewClientFromHTTP(httpClient).REST(hostname, http.MethodPost, u.String(), bytes.NewBuffer(payloadBytes), nil)
116}

Callers 2

SSHKeyUploadFunction · 0.85
SSHSigningKeyUploadFunction · 0.85

Calls 3

NewClientFromHTTPFunction · 0.92
RESTMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected