- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Issue with AddFile on Request #1714
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
Comments
How does the request look like in Postman? |
Please use something like https://requestbin.com to compare the request posted with Postman, and with RestSharp. Expand the headers section, and use raw content view when making screenshots. |
Headers from Postman
Headers from Restsharp
Sorry to say that I misssed something earlier. The request from Restsharp is not sending params other than one from AddFile. Is this something that is impossible to do with Restsharp? I tried only sending the image and it worked. But with other content, I am getting the same error. |
I don't think you are posting JSON with Postman, I think you post the form data. Please just take a screenshot from requestbin.com of the raw request coming from Postman. |
Yes, I am using form-data to send the data from Postman as we can't attach file using other formats in Postman. I extracted those requests from the server itself. I tried using AddBody instead of AddJsonBody in Restsharp but it too didn't work. |
You need to make a choice, whether you are posting form data, or you are posting a JSON payload. Posting form parameters with RestSharp is done by using |
I think |
I am using Restsharp to send a POST request to my REST API running Laravel. Specifically, what I am trying to do is to create a new user from my WPF app which sends some user details and profile image as post params. I tried the same thing with Postman and it is working fine but it didn't work as expected while using Restsharp. I am getting
PHP Warning: File Upload Mime headers garbled in Unknown on line 0
on my Laravel server.Code I am using:
Environment
The text was updated successfully, but these errors were encountered: