puppetlabs / clj-http-client

HTTP client library wrapping Apache HttpAsyncClient
Apache License 2.0
15 stars 30 forks source link

(TK-23) Port to apache HttpAsyncClient #7

Closed cprice404 closed 10 years ago

cprice404 commented 10 years ago

For now it only supports constructing a new client on every request. I intend to add API for creating a client explicitly, and a protocol for how to interact with the client. This will allow users to re-use an existing client as they see fit... but this hasn't been implemented yet.

ghost commented 10 years ago

Somehow the single commit in this PR was made by "Jenkins User." It would be sweet if Old Man Jenkins could write code of this quality, but I'm guessing he didn't do this.

KevinCorcoran commented 10 years ago

@cprice404 - Since part of your goal with this PR seems to be to validate the decision to swap-out http-kit with httpcomponents, would you mind explaining why you think that's the right move?

I haven't been following this issue closely, but from an outsider's perspective, I don't quite see this being worth it yet; the downside of http-kit seems rather small - the inconsistent exception type seems like a very minor issue to me, and these code changes seem rather large (although I haven't dug in, so I don't know how much of these changes are related to this and how much is made up of the API changes).

I'm sure you've thought about this more than I have, so I don't mean to put the kibosh on this, but I'd be interested to hear your reasoning.

Also, would it be possible to separate this work out into 2 pieces? One being the switch from http-kit -> httpcomponents, and the second part being the API changes? I think it'd make it a lot easier to review.

cprice404 commented 10 years ago

Reasons to switch:

So, moving in this direction, in my mind, allows to be a lot more careful / prescriptive about what the API should look like, and also build on top of a library that gives me less concern about stability / maturity.

As to breaking this into two commits, I don't think that can realistically be done without investing a bunch more time into it and making the PR much larger... the reason is that the API changes are all removals; to submit a PR that didn't change the API I'd have to actually implement all of the flags/features that were exposed in the previous API.

KevinCorcoran commented 10 years ago

That makes sense, thanks.

MSLilah commented 10 years ago

It's very possible that I missed something, but in my view the test coverage and the reasoning for the changes both seem reasonable.

nwolfe commented 10 years ago

:see_no_evil:

KevinCorcoran commented 10 years ago

I briefly reviewed the tests and main clojure and java APIs and don't see any problems. :see_no_evil:

cprice404 commented 10 years ago

Pushed commits to fix all of the obvious stuff above. There were a few comments above where I left a question, so if folks think that additional follow-up is needed for those threads then I can add more commits.

nwolfe commented 10 years ago

Assuming this is done and awaiting merge...

I think I'm done with reviewing this, and looks @KevinCorcoran is too. @jmay-puppet was in here a bit too. @camlow325 you want in on this or should I push the button?

camlow325 commented 10 years ago

Sounds like we've had a pretty thorough review on this one so, yeah, @nwolfe, I'm good with you pushing the button on this one.

cprice404 commented 10 years ago

@pcarlisle wants to take a quick look at this too.

pcarlisle commented 10 years ago

this seems fine for us

KevinCorcoran commented 10 years ago

I left one more nitpick but it's very minor. I'm going to merge this since it's been open for ages and it seems like all parties are :+1:

cprice404 commented 10 years ago

The other usage of ByteArrayInputStream is in a test for the java API... so callers would likely not have access to the clojure libraries, so it seems better to test it this way.