MCPcopy Create free account
hub / github.com/UiPath/uipathcli / writeMultipartForm

Method writeMultipartForm

utils/api/orchestrator_client.go:135–153  ·  view source on GitHub ↗
(writer *multipart.Writer, stream stream.Stream, contentType string)

Source from the content-addressed store, hash-verified

133}
134
135func (c OrchestratorClient) writeMultipartForm(writer *multipart.Writer, stream stream.Stream, contentType string) error {
136 filePart := textproto.MIMEHeader{}
137 filePart.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, stream.Name()))
138 filePart.Set("Content-Type", contentType)
139 w, err := writer.CreatePart(filePart)
140 if err != nil {
141 return fmt.Errorf("Error creating form field 'file': %w", err)
142 }
143 data, err := stream.Data()
144 if err != nil {
145 return err
146 }
147 defer func() { _ = data.Close() }()
148 _, err = io.Copy(w, data)
149 if err != nil {
150 return fmt.Errorf("Error writing form field 'file': %w", err)
151 }
152 return nil
153}
154
155func (c OrchestratorClient) GetReleases(folderId int, processKey string) ([]Release, error) {
156 request := c.createGetReleasesRequest(folderId, processKey)

Callers 1

writeMultipartBodyMethod · 0.95

Calls 4

CloseMethod · 0.80
SetMethod · 0.65
NameMethod · 0.65
DataMethod · 0.65

Tested by

no test coverage detected