clj-commons/clj-http-lite

Mocking with clj-http-fake doesn't seem to work

anderseknert opened this issue · 6 comments

I'm trying to mock requests with the clj-http-fake library as suggested in the README, but it seems real requests are always sent. Looking at the implementation there it seems to assume the non-lite version of the client, but perhaps I'm simply misunderstanding something?

lread commented

@anderseknert I was wondering about that too when reviewing the docs.

It was on my todo list to test, but (maybe unfortunately for you!), you did this for me.

My current guess is that the "Faking clj-http responses" section might have been copied over from clj-http years ago and never tested. I'm tempted to delete the section.

Apologies for the time you wasted looking into this, but also... thanks for looking into this!

No sweat @lread :) While one might need to provide some additional logic if path matching is required, I got by just fine with using with-redefs. Perhaps rather than removing the section entirely, we could show an example or two of how to use that for mocking?

lread commented

Oh, yeah @anderseknert, if you have a minimal example that works, a README PR would be much appreciated!

Sure thing! Busy week ahead, but I'll submit something as soon as I can 🙂

lread commented

Cool, thanks @anderseknert! If your current usage is public, I can take a stab at a README example if you provide a link.

PR is up :) Project where I'll be using this is over here. Although the http stuff is still WIP.