internal static HttpContent CreateFileContent(IRestClient client, IRequestFile file, bool inMultipart = false) { HttpContent content = new StreamContent(file.Content, file.BufferSize); content.Headers.ContentLength = file.Content.Length; if (!String.IsNullOrEmpty(file.ContentType)) { content.Headers.ContentType = MediaTypeHeaderValue.Parse(file.ContentType); } else if (client.Settings.ContentTypeProvider != null && !String.IsNullOrEmpty(file.FileName)) { string contentType; if (client.Settings.ContentTypeProvider.TryGetContentType(file.FileName, out contentType)) { content.Headers.ContentType = MediaTypeHeaderValue.Parse(contentType); } } if (!inMultipart) { var multipart = new MultipartFormDataContent(); multipart.Add(content, file.Name, file.FileName); content = multipart; } return(content); }
public bool TryGetValue(string key, out IRequestFile value) { return this.Memo.TryGetValue(key, out value); }
public bool TryGetValue(string key, out IRequestFile value) { return(this.Memo.TryGetValue(key, out value)); }
public Task <string> UploadFileAsync(IRequestFile file, [RequestForm] string name) { throw new NotImplementedException(); }
public Task <string> UploadFilesAsync(IRequestFile file1, IRequestFile file2, IRequestFile file3) { throw new NotImplementedException(); }
public Task <string> UploadFileAsync(IRequestFile file, TestServiceParam param) { throw new NotImplementedException(); }
public static IRequestBuilder WithFile(this IRequestBuilder builder, IRequestFile file) { return(builder.With(file)); }
public FeignClientFileRequestContent(string name, IRequestFile requestFile) { Name = name; RequestFile = requestFile; }