Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Unassigned: [Regression]XmlMediaTypeFormatter does not serialize Uri input correctly [1070]

$
0
0
Uri- file://[7f:d:ee9e::7a:828e:c]/-861%A3+/F3&m/@pM is serialized as file://[7f:d:ee9e::7a:828e:c]/-861%**25**A3+/F3&m/@pM on server by XmlMediaTypeFormatter(Notice 25(bolded) added to the url). This works fine when using Json formatter.

Here is my client code
HttpClient client = new HttpClient();
Uri myUri = new Uri("//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM", UriKind.Absolute);

HttpRequestMessage request = new HttpRequestMessage()
{
Content = new ObjectContent<Uri>(myUri, new XmlMediaTypeFormatter()),
RequestUri = new Uri(baseAddress + "/My/EchoUriFromBody"),
Method = new HttpMethod("Post"),
};
var response = client.SendAsync(request).Result;
var myResult = response.Content.ReadAsAsync<Uri>(new List<MediaTypeFormatter>(){new XmlMediaTypeFormatter()}).Result;

Controller code
public class MyController : ApiController
{
[AcceptVerbs("PUT", "POST", "DELETE")]
public Task<Uri> EchoUriFromBody([FromBody]Uri input)
{
var task = Task.Factory.StartNew(() => input);
return task;
}
}
Comments: You marked the bug as regression, in what version did this work in the XML formatter?

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>