TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Unirest

174 pointsby sinzoneover 11 years ago

28 comments

aromanover 11 years ago
As cool (and pretty) as this is, I&#x27;m not sure I see the point to using this over each language&#x27;s best native http client. As someone else said, Python&#x27;s requests is fantastic, as is the mikeal&#x2F;request library in node.<p>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?
评论 #6589051 未加载
tfinchover 11 years ago
Looks nice - but unfortunately as someone whose day-to-day language is python, I&#x27;ll give up my requests library [1] when you pry it from my cold, dead hands.<p>[1]<a href="http://www.python-requests.org/en/latest/" rel="nofollow">http:&#x2F;&#x2F;www.python-requests.org&#x2F;en&#x2F;latest&#x2F;</a><p>Not mine mine, it should be obvious. I&#x27;m not Kenneth Reitz.<p>In all seriousness, would be interested to hear about differences&#x2F;benefits...
评论 #6588983 未加载
评论 #6594659 未加载
onion2kover 11 years ago
Looking at the examples for Node and PHP, those are essentially two different request libs with the same name. That lack of consistency is a problem - at the very least anyone thinking &quot;porting this app to &lt;language&gt; will be easy because Unirest is available&quot; will be in for a nasty surprise. At worst, it shows a lack of planning and a lack of communication within the Unirest team, and that&#x27;s a <i>very</i> big problem for anyone relying on the code.<p>Moving forward, I&#x27;d recommend working very hard on unifying your featureset and API so it&#x27;s consistent across all the versions.
评论 #6593908 未加载
joshguthrieover 11 years ago
Thanks for this. I&#x27;m already using Unirest.php to build a client library for my API and Unirest.rb is my obvious choice when I come to build the Ruby client lib.<p>As aroman said, some languages have nice built-in capabilities but some...just don&#x27;t (PHP, I&#x27;m looking at you!). I love having this unified API which is very intuitive (especially when coming back to PHP after...7 years).<p>Keep up the good work!
zamalekover 11 years ago
You really need to make an effort to conform with established naming&#x2F;casing conventions in each language [1]. For example, your example page should read [2] for .Net.<p>[1]: <a href="https://github.com/Mashape/unirest-net/blob/master/unirest-net/unirest-net/src/http/Unirest.cs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Mashape&#x2F;unirest-net&#x2F;blob&#x2F;master&#x2F;unirest-n...</a> [2]: <a href="https://gist.github.com/jcdickinson/4dd0125d7c5af9d4878f" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;jcdickinson&#x2F;4dd0125d7c5af9d4878f</a>
zaidosover 11 years ago
Small tip: It could just be me, but the color of some of the text makes it difficult to read.
评论 #6588896 未加载
Killswitchover 11 years ago
The PHP version seems to be meh... Gotta do a lot to get us away from Guzzle. <a href="http://guzzlephp.org/" rel="nofollow">http:&#x2F;&#x2F;guzzlephp.org&#x2F;</a>
评论 #6589625 未加载
评论 #6589272 未加载
评论 #6591207 未加载
seivanover 11 years ago
I found code like &#x27; int code = [response code];&#x27; Why &#x27;int&#x27; and not &#x27;NSInteger&#x27;?<p>That being said, I&#x27;ve been looking for a <i></i>NotWorking replacement, and this might be it. Either this or I write my own once and for all.<p>Will give it a go! Also; <a href="https://github.com/Mashape/unirest-obj-c/pull/8" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Mashape&#x2F;unirest-obj-c&#x2F;pull&#x2F;8</a>
评论 #6590436 未加载
mediumdeviationover 11 years ago
This doesn&#x27;t seem to be a good idea<p><pre><code> curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); </code></pre> <a href="https://github.com/Mashape/unirest-php/blob/master/lib/Unirest/Unirest.php#L98" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Mashape&#x2F;unirest-php&#x2F;blob&#x2F;master&#x2F;lib&#x2F;Unire...</a>
评论 #6589478 未加载
jamesmossover 11 years ago
It&#x27;s a shame the PHP lib has a completely static API. It makes it very hard to mock when doing unit testing.
netghostover 11 years ago
Minor nit, the ruby examples show:<p><pre><code> Unirest::post &quot;http:&#x2F;&#x2F;httpbin.org&#x2F;post&quot;, ... </code></pre> That syntax is deprecated, you should probably just use:<p><pre><code> Unirest.post &quot;http:&#x2F;&#x2F;httpbin.org&#x2F;post&quot;, ... </code></pre> I like the site though ;)
评论 #6589548 未加载
btownover 11 years ago
Interesting - does the Node version work if packaged for the browser i.e. by Browserify? Of course, there would be caveats, but it would seem like that would be very much in the spirit of this unified API.
评论 #6588963 未加载
rezniteover 11 years ago
I believe this the old unicorn library which was submitted here a few times in the past. <a href="http://getunicorn.io/" rel="nofollow">http:&#x2F;&#x2F;getunicorn.io&#x2F;</a> I believe
评论 #6590579 未加载
ImJasonHover 11 years ago
The Java library&#x27;s use of a static method makes it difficult to inject and mock out for tests, requiring a wrapper class to be written by hand to make such things possible.
clienthunterover 11 years ago
I love Ruby so much that I shuddered a little when I saw the multi-line, multi-hash method call in the example code that made it look like js. Otherwise thumbs up.
tomphooleryover 11 years ago
Heh, platform-independence...I guess that&#x27;s one way to get them to use <i>your</i> HTTP library, as opposed to the thousand other libs out there to do HTTP. ;)<p>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&#x27;s nice to have one less thing to look up when experimenting with a new language.
felipesabinoover 11 years ago
It should really use cocoapods for the objc library, as it correctly uses major package manager for all other platforms
评论 #6589214 未加载
评论 #6596515 未加载
MojoJoloover 11 years ago
Nice one Augusto and Mashape. I checked Java and it is using Maven. I would like to contribute with Scala and SBT.
评论 #6589143 未加载
评论 #6589138 未加载
评论 #6589127 未加载
ultimatedelmanover 11 years ago
The sticky footer on the bottom of the homepage blocks the bottom options. I&#x27;d make it not sticky ;)
评论 #6588965 未加载
ozhover 11 years ago
I recommend documenting that in PHP it&#x27;s just a curl wrapper, as opposed to a lib that can work with curl, streams, etc... (nothing condescending on &#x27;&quot;just&quot; a wrapper&#x27;). Also give some insights on requirements (PHP 5.3+ I&#x27;d say?)
zampanoover 11 years ago
I actually used unirest.rb as one of the tools to teach my students about HTTP requests. I loved the clear syntax and found the experience a lot more straight-forward than many of the other HTTP libraries I came across. Thanks for putting this together!
hayksaakianover 11 years ago
If you could implement this for Unity3d using C# I&#x27;d be so happy
评论 #6590671 未加载
评论 #6588981 未加载
Groxxover 11 years ago
This makes me realize what I&#x27;ve been missing in most Java request libraries. And gives me ideas for building my own. Thanks for sharing!
评论 #6589260 未加载
damusnetover 11 years ago
Laravel kept complaining it couldn&#x27;t convert Response Object to string or json encode. Looked nice though :-(
Jemaclusover 11 years ago
I love this, mainly because it&#x27;s almost identical to my custom PHP remote wrapper.
sirsarover 11 years ago
Is there more documentation than what&#x27;s listed when a language is clicked?
tomekmarchiover 11 years ago
Very pretty, both in terms of code and site design.
the1over 11 years ago
why not support proper http including caching