Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion RestAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,12 @@ public virtual async Task<string> SendHttpClientRequest<T>(string endpoint, Requ
httpWebRequest.ContentType = "application/x-www-form-urlencoded";

Stream dataStream = await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false);
FileStream fileStream = new FileStream(parms["path"], FileMode.Open, FileAccess.Read);

// If the given path is a physical path, open file. If not, read from URL.
var fileStream = parms["source"] == "local" ?
new FileStream(parms["path"], FileMode.Open, FileAccess.Read) :
(new WebClient()).OpenRead(parms["path"]);

byte[] buffer = new byte[4096];
int bytesRead = 0;

Expand Down