MCPcopy
hub / github.com/perkeep/perkeep / post

Method post

pkg/client/client.go:1181–1192  ·  view source on GitHub ↗
(ctx context.Context, url string, bodyType string, body io.Reader)

Source from the content-addressed store, hash-verified

1179}
1180
1181func (c *Client) post(ctx context.Context, url string, bodyType string, body io.Reader) (*http.Response, error) {
1182 if !c.sameOrigin && !strings.HasPrefix(url, c.discoRoot()) {
1183 return nil, fmt.Errorf("wrong URL (%q) for this server", url)
1184 }
1185 req := c.newRequest(ctx, "POST", url, body)
1186 req.Header.Set("Content-Type", bodyType)
1187 res, err := c.expect2XX(req)
1188 if err != nil {
1189 return nil, err
1190 }
1191 return res, nil
1192}
1193
1194// newRequest creates a request with the authentication header, and with the
1195// appropriate scheme and port in the case of self-signed TLS.

Callers 8

PostMethod · 0.95
SignMethod · 0.95
setUploadingMethod · 0.80
setFileStatusMethod · 0.80
setByteStatusMethod · 0.80
setUploadStatusTextMethod · 0.80
setUploadStatsTextMethod · 0.80
setUploadErrorsTextMethod · 0.80

Calls 5

discoRootMethod · 0.95
newRequestMethod · 0.95
expect2XXMethod · 0.95
HasPrefixMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected