Show HN: Unirest
unirest.io
unirest.io
Point being, why would I choose this over a library which is hand-tailored to fit the idioms of the specific language its written for? What advantage does one get by forcing a relatively standard REST API across different languages?
To answer your question aside from the additional features, I think each one is specifically written for the language, built on-top of existing frameworks to bring a easier interface... and what I have personally found developing technologies using this (the site actually uses Unirest Node.js to generate the source, and on our website we use this to show snippets in multiple languages without a drastically different syntax) is the ease of going from one language to the next without having to think too much, and a good pool of documentation in-case you get stuck.
[1]http://www.python-requests.org/en/latest/
Not mine mine, it should be obvious. I'm not Kenneth Reitz.
In all seriousness, would be interested to hear about differences/benefits...
I don't like the idea of libraries competing with each other, I personally think they all get the niche of users who can decide which one to use accordingly to the problem they try to fix.
Moving forward, I'd recommend working very hard on unifying your featureset and API so it's consistent across all the versions.
unirest.get('http://httpbin.org/gzip', { 'Accept': 'gzip' }, 'Hello World', function (response) { });
or var Request = unirest.get('http://httpbin.org/gzip', { 'Accept': 'gzip' }, 'Hello World');
Request.end(function (response) {});As aroman said, some languages have nice built-in capabilities but some...just don't (PHP, I'm looking at you!). I love having this unified API which is very intuitive (especially when coming back to PHP after...7 years).
Keep up the good work!
[1]: https://github.com/Mashape/unirest-net/blob/master/unirest-n... [2]: https://gist.github.com/jcdickinson/4dd0125d7c5af9d4878f
Looks great otherwise!
My attention is caught now that I see a composer.json. Friction is limited. Now what?
That being said, I've been looking for a NotWorking replacement, and this might be it. Either this or I write my own once and for all.
Will give it a go! Also; https://github.com/Mashape/unirest-obj-c/pull/8
Most of the library seems pretty straight forward. I will have to dig deeper when I get some time over. I'm debated wether or not to use this as work for a project.
I still doubt as much thought has gone into it as a more mature library like AFNetworking (https://github.com/AFNetworking/AFNetworking) though. Even then the new NSURLSession APIs in iOS7 pretty much remove the need for a 3rd party networking lib.
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
https://github.com/Mashape/unirest-php/blob/master/lib/Unire...While reviewing this section of the code they should also probably do manual support for FOLLOWLOCATION or check open_basedir, which is usually set--or should be.
Unirest::post "http://httpbin.org/post", ...
That syntax is deprecated, you should probably just use: Unirest.post "http://httpbin.org/post", ...
I like the site though ;)I'm not convinced that I'd use it, but this doesn't hurt to do. To be fair, my changes haven't been tested.
(Thanks to you, I actually just found this, and will probably do this later today!)
But I like it! In all seriousness this is neat and I like the idea of ubiquitous library syntax, especially for new programmers (which there are a LOT of these days!). The API is reasonably simple and it's nice to have one less thing to look up when experimenting with a new language.
edit: went ahead and added a pull request for a .podspec. Only a little bit of extra work, since I was writing one to test it out locally anyway.
Thanks for your contribution
[1]:http://entitycrisis.blogspot.co.uk/p/unityweb-www-alternativ...
Before you ask, I don't control the response, so I can't do something more sane :) And it's on Android, so memory can be quite restrictive, and GC hurts a lot with so much allocation.
I don't see an easy way to plug those requirements into this library. Superficially it seems I can modify/add something inherited from BaseRequest and add my own HttpClientHelper.requestAsync-style method to do this, but it's yet another library that doesn't quite allow this kind of thing natively.
But by the time I've understood and made those changes, I might as well just do it all by hand in that particular request. This is especially true since my code has to be read and understood by others I work with, and it makes updating the Unirest library a much more error-prone event that might leave people in the lurch since they didn't write the extension. There's no real happy solution.
--
Not that I really think it should easily handle my case - it looks really nice to use, and it's probably not worth it to you / most people, and my case is weird and might ruin everything to properly support. But it's a minor thing that annoys me a bit and makes me want to make my own (minor annoyances are a major motivator for my personal projects). Before I can make anything decent though I need to see a few more ways to do things, try a few crazy architectures, etc. This has helped remind me what it can look like at least, and the code looks surprisingly clean underneath. Definitely a worthwhile read :)