-
Notifications
You must be signed in to change notification settings - Fork 713
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
set content type for multipart form #109
Comments
@gh0st42 Thank you for your appreciation. |
Okay, adding a previously create multipart on the fly is not supported by resty so I either have to build the complete request myself OR patch resty. I opted for the latter and made a pull request implementing your solution in resty. So far I only did this for the SetFileReader function but this could easily be done for the others as well. |
Hi, thanks for making Resty! I just wanted to add that this feature would be extremely useful for me too. I will patch my source using gh0st42's PR for now (thanks gh0st42!), but do you know when you expect to have a fix implemented as part of the mainline? Thanks |
Ok, I will do that for now. Looking forward to the generic solution too. Thanks for your help. |
@oadk can you please try it out and share your feedback? |
Hi, thanks for making the change! I have tried it out and unfortunately there is a problem. It appears that in some circumstances, too much data is being written for the file data. I have looked through the code, and I think the problem is in writeMultipartFormFile() on this line:
The problem is that when we get to the end of the file, cbuf will not be completely full. Therefore, we should not write the entire buffer contents. I think the line should really be like this:
Also, I think the other Hope this helps. Thank you for looking into the feature. |
@oadk Thank you for your feedback and testing. Its very helpful. |
Hi @jeevatkm, I have tried this version and it works great! Thank you :) |
@oadk Nice, thank you. Glad to hear that. I'm gonna merge the PR. |
The
SetFile()
andSetFileReader()
functions always set the content-type toapplication/octet-stream
but I need to set it totext/plain
. There is no obvious way to set individual content types for multiple parts attached to a request.SetHeader()
with content-type affects the main request.For the web-service I try to use I need a request that looks like the following:
The following code comes quite close:
Producing the following POST request:
Am I overlooking something or is this functionality simply not implemented?
The rest of the API is very straight forward and easy to use, great work!
The text was updated successfully, but these errors were encountered: