WeTransfer / Mocker

Mock Alamofire and URLSession requests without touching your code implementation
MIT License
1.12k stars 96 forks source link

Feature request: ignoring domains/subdomains or URL prefix #93

Closed rogerluan closed 6 months ago

rogerluan commented 3 years ago

Hey 👋

I constantly see Mocker warnings about not mocking 3rd party URLs such as from mixpanel or Realm. The problem is that the URLs look like:

https://api.mixpanel.com/track/?data=eyJldmVudCI………redacted-for-brevity-but-it's-a-really-long-url-jBkYmQ3ODzeCJ9fQ==&ip=1
https://static.realm.io/update/cocoa?x.y.z // where x.y.z is my Realm library version

Thus I thought if I called:

Mocker.ignore(URL(string: "https://static.realm.io")!)

That Mocker would ignore all requests within this domain, but it doesn't.

I'd like to be able to ignore calls to realm.io or mixpanel.com (perhaps even omitting static. or api. for instance), or at least https://static.realm.io and https://api.mixpanel.com.

I'm aware of a function to ignore all URLs but really doesn't accomplish the goal because I like the warnings for all requests that are from my own application.

What are the challenges around implementing this? Are there any risks?

Appreciate all the help!

rogerluan commented 3 years ago

Bump

rogerluan commented 3 years ago

Ugh.. I commented and the bot still closed my issue anyway 😥 @AvdLee could you reopen this issue? And perhaps label is somehow that it doesn't get auto-closed? 🙇 🙏

AvdLee commented 3 years ago

@rogerluan this sounds like a valuable feature! We don't have the time to work on these requests, unless we need them ourselves. We do allow contributions and we're often fast in reviewing those.

If you can find the time to implement this, feel free to do so and I'm happy to review it right after!

rogerluan commented 3 years ago

Thanks for the response @AvdLee ! If I can find the time I'll open a PR with a proposal 🤗

rogerluan commented 3 years ago

Oh no, it's the stale bot again 😕

rogerluan commented 3 years ago

Can the bot be selectively disabled for specific PRs? Say, by adding a special label? :)

AvdLee commented 3 years ago

Can the bot be selectively disabled for specific PRs? Say, by adding a special label? :)

That's a very good question and that can actually be useful. Let me see!

AvdLee commented 3 years ago

Fixed that, it should no longer happen due to the enhancement label!

rogerluan commented 3 years ago

Thank you @AvdLee ❤️

rogerluan commented 3 years ago

It seems like the enhancement label didn't prevent stale bot from visiting this issue again 😢

AvdLee commented 3 years ago

I updated our stale manager, should be fixed now