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

Method createUploadRequest

utils/api/orchestrator_client.go:104–119  ·  view source on GitHub ↗
(file stream.Stream, feedId string, uploadBar *visualization.ProgressBar, cancel context.CancelCauseFunc)

Source from the content-addressed store, hash-verified

102}
103
104func (c OrchestratorClient) createUploadRequest(file stream.Stream, feedId string, uploadBar *visualization.ProgressBar, cancel context.CancelCauseFunc) *network.HttpRequest {
105 bodyReader, bodyWriter := io.Pipe()
106 streamSize, _ := file.Size()
107 contentType := c.writeMultipartBody(bodyWriter, file, "application/octet-stream", cancel)
108 uploadReader := c.progressReader("uploading...", "completing ", bodyReader, streamSize, uploadBar)
109
110 uriBuilder := c.newUriBuilder("/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage")
111 if feedId != "" {
112 uriBuilder.AddQueryString("feedId", feedId)
113 }
114 uri := uriBuilder.Build()
115 header := http.Header{
116 "Content-Type": {contentType},
117 }
118 return network.NewHttpPostRequest(uri, c.toAuthorization(c.token), header, uploadReader, -1)
119}
120
121func (c OrchestratorClient) writeMultipartBody(bodyWriter *io.PipeWriter, stream stream.Stream, contentType string, cancel context.CancelCauseFunc) string {
122 formWriter := multipart.NewWriter(bodyWriter)

Callers 1

UploadMethod · 0.95

Calls 8

writeMultipartBodyMethod · 0.95
progressReaderMethod · 0.95
newUriBuilderMethod · 0.95
toAuthorizationMethod · 0.95
NewHttpPostRequestFunction · 0.92
AddQueryStringMethod · 0.80
SizeMethod · 0.65
BuildMethod · 0.45

Tested by

no test coverage detected