VKCOM / vk-windowsphone-sdk

VK SDK for Windows Phone
22 stars 14 forks source link

VkHttpRequestHelper bug in Upload() via Http.HttpClient() for non-Silverlight app #26

Open sulesh92 opened 7 years ago

sulesh92 commented 7 years ago

VkHttpRequestHelper --> public static async void Upload(...)

var httpClient = new Windows.Web.Http.HttpClient(); HttpMultipartFormDataContent content = new HttpMultipartFormDataContent(); content.Add(new HttpStreamContent(data.AsInputStream()), paramName, fileName ?? "myDataFile"); ---> content.Headers.Add("Content-Type", uploadContentType); <--- var postAsyncOp = httpClient.PostAsync(new Uri(uri, UriKind.Absolute), content);

Error in line content.Headers.Add("Content-Type", uploadContentType); key Content-type is already exist in Header.

1) content.Headers.ContentType = new Windows.Web.Http.Headers.HttpMediaTypeHeaderValue("image/jpeg"); Doesn`t help. 2) Without this string Server response is "400 Bad request"

For UWP app I need this method. Thanks in advance!

V1460kw commented 7 years ago

Ok