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

Custom URLProtocol doesn't work with firebase calls #138

Closed
jerbeers opened this issue Jul 17, 2017 · 1 comment
Closed

Custom URLProtocol doesn't work with firebase calls #138

jerbeers opened this issue Jul 17, 2017 · 1 comment

Comments

@jerbeers
Copy link

  • Xcode version: 8.3.3 and 9.0 beta 3
  • Firebase SDK version: 4.0.0
  • Firebase Product: auth, database

I use a custom URLProtocol class in my tests. If I register my URLProtocol class and use URLSession to load a URL, the custom class is used, but if I make a call to any firebase API, the custom class doesn't get used.

Steps to reproduce:

  1. Write a URLProtocol subclass, implement canInit(with request:), set a breakpoint here
  2. In the setUp() method of your test class, add URLProtocol.registerClass(CustomURLProtocol.self)
  3. Write a test and load any URL using URLSession.shared.dataTask(with:)
  4. Run the test and notice the breakpoint in canInit gets hit
  5. Change the test to call Auth.auth().createUser or Database.database().reference().child(path).setValue
  6. Run the test and notice the breakpoint in canInit does not get hit
@jerbeers
Copy link
Author

Sorry, I think I misunderstood how registerClass would work. It works for the shared instance of URLSession, but not one with a set configuration. I'll look for another way to test.

@firebase firebase locked and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants