Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Returning {} instead of null when no data at path #142

Closed
wyattisimo opened this issue Oct 17, 2019 · 0 comments
Closed

Returning {} instead of null when no data at path #142

wyattisimo opened this issue Oct 17, 2019 · 0 comments

Comments

@wyattisimo
Copy link
Contributor

I'm using this to mock Firebase for tests in a Ruby app. Certain tests are failing due to firebase-server returning an empty object instead of null when no data exists at a given path.

If I target a real Firebase project:

fb.get('/bogus/path') # make a RESTful GET request to a nonexistent path in Firebase
#=> nil

If I target the locally running firebase-server:

fb.get('/bogus/path') # make a RESTful GET request to a nonexistent path in Firebase
#=> {}

It would seem this is a result of the following line:

writeResponse(response, snapshot.val() || {});

Is this deliberate? Am I missing something, or should that code be failing over to null instead of {}?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants