this from VB. I'll give it a shot and see if I can figure out
On Sep 27, 12:50 pm, Andrew Young <
andrewdyo...@gmail.com> wrote:
> You will have to rebuild RestSharp. It would be nice to have PreparePostBody to detect whether it is actually a multipart request vs. just assuming that it is a multipart if there are files attached.
>
> If you end up fixing it, send a pull request and we'll consider adding it to RestSharp.
>
>
>
>
>
>
>
> On Tuesday, September 27, 2011 at 9:45, Mark wrote:
> > My mistake in the title. I actually want to force the HEADER Content-
> > Type parameter to another value when using a file upload.
>
> > I can now see that the ContentType gets forced to "multipart/form-
> > data" if there are files to be uploaded. Can anybody suggest a way
> > that I can force the header Content-Type parameter to another value
> > without actually changing and rebuilding the library? Or does it make
> > more sense to rebuild the library?
>
> > I've isolated it in the RestSharp library under Http.cs:
> > private void PreparePostBody(HttpWebRequest webRequest) {
> > if(HasFiles) { webRequest.ContentType =
> > GetMultipartFormContentType(); } else if(HasParameters) {
> > webRequest.ContentType = "application/x-www-form-urlencoded";
> > RequestBody = EncodeParameters(); } else if(HasBody) {
> > webRequest.ContentType = RequestContentType; } }
>
> > Thanks!
>
> > On Sep 26, 7:04 pm, Mark <
markpop...@gmail.com (
http://gmail.com)> wrote:
> > > Thanks, I'll play around with it a bit more. I'm actually posting a
> > > PDF document, but I can't tell how it's handled in the background.
>
> > > It's just frustrating as I was able to perform this operation in REST
> > > Console (a very cool Chrome extension, IMHO), but I need to build an
> > > app to do it.
>