You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example application or steps to reproduce the problem
Plumber Code
function(req) {
tempFolder<-'temp/'uuid<- UUIDgenerate()
remotePath<- paste0(tempFolder, uuid)
# upload data filetmpFile<- tempfile()
#! this step won't work when calling from C# as req$body$file does not exist
writeBin(req$body$file$parsed, tmpFile)
return(uuid)
}
Describe the problem in detail
C# client-side code
This does not work
// Create an HttpClient instanceusingvarhttpClient=new HttpClient(new ClientHandler());// Create a multipart form data content// Setting the content type manually does not work, I've tried thatvarcontent=new MultipartFormDataContent();// Read the file content as a byte array -> dataPath is defined further up and points to an excel filevarfileContent= File.ReadAllBytes(dataPath);// Add the file content as a ByteArrayContent to the multipart form data
content.Add(new ByteArrayContent(fileContent),"file.xlsx","file.xlsx");// Make the POST requestvarresponse=await httpClient.PostAsync(new Uri($"{autosumApi}/send"), content);// Read and print the responsevarresponseText=await response.Content.ReadAsStringAsync();
Console.WriteLine(responseText.First());
The response I get is 500 /w ["Error in writeBin(req$body$file$parsed, tmpFile): can only write vector objects\n"]
I've been trying to get the same situation working today...
And ended up digging inside plumber and webutils as I couldn't get it to work.
Eventually I worked out that there's a problem with plumber's multipart parsing if the boundary marker is quoted - i.e. if it's presented in the content type headers like: multipart/form-data; boundary="custom_boundary_123" rather than multipart/form-data; boundary=custom_boundary_123
I've fixed this in my plumber fork - slodge@f0e37b8 - which is in #905 - but I don't have any timeline on if/when that might get merged.
System details
Output of
sessioninfo::session_info()()
:Example application or steps to reproduce the problem
Plumber Code
Describe the problem in detail
C# client-side code
This does not work
The response I get is 500 /w
["Error in writeBin(req$body$file$parsed, tmpFile): can only write vector objects\n"]
C# client-side request
Python client-side code
This works
If I return the request, I get a UUID back, as expected.
Python client-side request
The text was updated successfully, but these errors were encountered: