Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload with Unirest-net not working #2

Closed
piyushkp opened this issue Jul 28, 2013 · 3 comments
Closed

File upload with Unirest-net not working #2

piyushkp opened this issue Jul 28, 2013 · 3 comments

Comments

@piyushkp
Copy link

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)

@ismaelc
Copy link
Contributor

ismaelc commented Jul 28, 2013

Piyush what error were you getting?

@piyushkp
Copy link
Author

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:

  1. public HttpRequest field(string name, string value)
  2. public HttpRequest field(Stream value)
  3. public HttpRequest fields(Dictionary<string, object> parameters)

@ismaelc
Copy link
Contributor

ismaelc commented Oct 19, 2013

I believe this has already been fixed - added public HttpRequest field(string name, byte[] data) method for uploading file

@ismaelc ismaelc closed this as completed Oct 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants