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

Inconsistent behavior when querying design documents with null, empty and invalid data #99

Open
lasselaakkonen opened this issue Jun 16, 2017 · 0 comments
Labels

Comments

@lasselaakkonen
Copy link

When POSTing queries to a design document through the REST API:

When POSTing an empty request body

  • macOS CBL 1.4.0 returns HTTP 400 with body {"status":400,"error":"Invalid parameter in HTTP query or JSON body"}
  • Android CBL 1.4.0 returns HTTP 493 with body {"error":"Invalid JSON","status":400,"reason":"Router unable to route request to do_POST_DesignDocumentcom.couchbase.lite.CouchbaseLiteException, Status: 493 (HTTP 400 Invalid JSON)"}
  • Didn't test other platforms

When POSTing {} as body

  • macOS CBL 1.4.0 returns HTTP 400 with body {"status":400,"error":"Invalid parameter in HTTP query or JSON body"}
  • Android CBL 1.4.0 returns HTTP 200 with all documents
  • Didn't test other platforms

When POSTing { foo: 123 } as body

  • macOS CBL 1.4.0 returns HTTP 400 with body {"status":400,"error":"Invalid parameter in HTTP query or JSON body"}
  • Android CBL 1.4.0 returns HTTP 200 with all documents
  • Didn't test other platforms

When POSTing { keys: [] } as body

  • macOS CBL 1.4.0 returns HTTP 200 with no documents
  • Android CBL 1.4.0 returns HTTP 200 with all documents
  • Didn't test other platforms

I ran in to the issue when POSTing {} as body, because of how my code happened to be structured. What I wanted was to get all documents, so I switched to using GET without parameters.

All platforms should work the same way, to avoid having to debug/test issues separately on all platforms.

@djpongh djpongh added the icebox label Aug 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants