Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anderseknert opened this issue Aug 21, 2022 · 6 comments · Fixed by #57
Closed

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

anderseknert opened this issue Aug 21, 2022 · 6 comments · Fixed by #57

Comments

@anderseknert
Copy link

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
Copy link
Collaborator

lread commented Aug 22, 2022

@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!

@anderseknert
Copy link
Author

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
Copy link
Collaborator

lread commented Aug 22, 2022

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

@anderseknert
Copy link
Author

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

@lread
Copy link
Collaborator

lread commented Aug 22, 2022

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

@anderseknert
Copy link
Author

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

@lread lread closed this as completed in #57 Aug 23, 2022
lread pushed a commit that referenced this issue Aug 23, 2022
Resolves #51

Signed-off-by: Anders Eknert <anders@eknert.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants