MCPcopy Create free account
hub / github.com/QuantumNous/new-api / postCommunityPluginInstall

Function postCommunityPluginInstall

controller/task_plugin.go:90–104  ·  view source on GitHub ↗
(installsURL string, body []byte)

Source from the content-addressed store, hash-verified

88}
89
90func postCommunityPluginInstall(installsURL string, body []byte) bool {
91 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
92 defer cancel()
93 request, err := http.NewRequestWithContext(ctx, http.MethodPost, installsURL, bytes.NewReader(body))
94 if err != nil {
95 return false
96 }
97 request.Header.Set("Content-Type", "application/json")
98 response, err := http.DefaultClient.Do(request)
99 if err != nil {
100 return false
101 }
102 _ = response.Body.Close()
103 return true
104}
105
106func UploadTaskPlugin(c *gin.Context) {
107 var request taskPluginUploadRequest

Callers 1

Calls 5

SetMethod · 0.80
NewReaderMethod · 0.65
DoMethod · 0.65
cancelFunction · 0.50
CloseMethod · 0.45

Tested by

no test coverage detected