File upload with Unirest-net not working
piyushkp opened this issue · 3 comments
I was trying to consume lambda API in my application where i have to upload a file:
.field("files", new MemoryStream("")) is not supported in Unirest-net.
HttpResponse response = Unirest.post("https://lambda-face-recognition.p.mashape.com/album_train")
.header("X-Mashape-Authorization", "wdfwerwerjjrlwernwlkrwlkrnewlrn")
.field("album", "")
.field("albumkey", "")
.field("entryid", "")
.field("files", new MemoryStream(""))
.field("urls", "")
.asJson();
Please resolve this issue by overloading the field method to (string, and stream)
Piyush what error were you getting?
In Unirest-net, there is no field method takes string and Stream as a input parameters. in Unirest-net we have following field overloaded methods:
- public HttpRequest field(string name, string value)
- public HttpRequest field(Stream value)
- public HttpRequest fields(Dictionary<string, object> parameters)
I believe this has already been fixed - added public HttpRequest field(string name, byte[] data) method for uploading file