Unirest-RT – Simplified, lightweight HTTP library for Windows 8 RT


One of my closed friends from Mashape asked me to help in porting their unirest-net library to Windows 8 RT. So, I took a few hours to port their library for Windows 8 RT runtime. You can take a look at my ported version of Unirest in this github respository https://github.com/michaelsync/unirest-rt.

Here is the list of what I changed in order to make .NET library work in Windows 8 RT runtime. I’m sharing it here because I think that it would be helpful for those who like to port some .NET library to Windows RT.

  • Changed “unirest-net” to “Class Library (Windows Store Apps)”
  • Changed “unirest-net-” to “Unit Test Library (Windows Store Apps)”
  • Added “Microsoft.Net.Http” nuget package that was released with Portable Library for RT and Phone.
  • Added “Newtonsoft.Json” nuget package because System.Web.Script.Serialization is not available in Windows RT

The following changes have been made in “unirest-net” project.

  • File Name: unirest-net/unirest-net/src/http/HttpResponse.cs (Note: — means “remove” and ++ means “added”)

    –using System.Web.Script.Serialization; –else if (typeof(Stream).IsAssignableFrom(typeof(T)))
    ++else if (typeof(Stream).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()))

    –var serializer = new JavaScriptSerializer(); var stringTask = response.Content.ReadAsStringAsync(); Task.WaitAll(stringTask);
    –Body = serializer.Deserialize(stringTask.Result);

    ++Body = JsonConvert.DeserializeObject(stringTask.Result);

  • File Name: unirest-net/unirest-net/src/request/HttpRequest.cs

    –using System.Web.Script.Serialization;
    –var serializer = new JavaScriptSerializer();
    –Body = new MultipartContent { new StringContent(serializer.Serialize(body)) };

    ++Body = new MultipartContent { new StringContent(JsonConvert.SerializeObject(body)) };

The following changes have been maded in “unirest-net-test” project.

  •  The original test project was using nunit unit test framework because Nunit Adapter VS extension (beta 5) doesn’t work with Win RT for some reasons. So, I changed it to VS unit test framework and removed the Nunit nuget package.
  • File Name: unirest-net/unirest-net-tests/src/http/UnirestTests.cs. The orignal code is using the capital “P” (e.g. Unitest.Post(..)..) so I changed to the small letter.


That’s all. Hope that you find it useful. If you like to share your experience and chellenge with porting .NET code to Windows RT, please drop a comment or email me via Contacts form. Thanks!

Happy porting!  (Well, I used to write “Happy Silverlighting!” but no more. :| )

2 Replies to “Unirest-RT – Simplified, lightweight HTTP library for Windows 8 RT”

  1. Using remote is more easy way to do any work.You don’t have to anything more and use your body work,Just click and do what you want,Just like that Microsoft windows has this awesome feature and if you are using this desktop then learn here how to activate.

Leave a Reply