Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-mem3/pull/16#discussion_r41781652
--- Diff: src/mem3_httpd.erl ---
@@ -44,7 +46,12 @@ handle_shards_req(#httpd{method='GET',
couch_httpd:send_json(Req, {[
{range, Shard},
{nodes, Dbs}
- ]}).
+ ]});
+handle_shards_req(#httpd{path_parts=[_DbName, <<"_shards">>]}=Req, _Db) ->
+ chttpd:send_method_not_allowed(Req, "GET");
+handle_shards_req(#httpd{path_parts=[_DbName, <<"_shards">>, _DocId]}=Req,
_Db) ->
--- End diff --
These not equivalent:
```
http post http://localhost:15984/db/_shards/foo/bar
HTTP/1.1 500 Internal Server Error
Cache-Control: must-revalidate
Content-Length: 70
Content-Type: text/plain; charset=utf-8
Date: Mon, 12 Oct 2015 17:40:54 GMT
Server: CouchDB/0f81930 (Erlang OTP/18)
X-Couch-Request-ID: 583b8991fd
X-Couch-Stack-Hash: 2152526230
X-CouchDB-Body-Time: 0
{"error":"unknown_error","reason":"function_clause","ref":2152526230}
```
vs
```
http post http://localhost:15984/db/_shards/foo/bar
HTTP/1.1 405 Method Not Allowed
Allow: GET
Cache-Control: must-revalidate
Content-Length: 59
Content-Type: text/plain; charset=utf-8
Date: Mon, 12 Oct 2015 17:42:25 GMT
Server: CouchDB/0f81930 (Erlang OTP/18)
X-Couch-Request-ID: 08e7452e04
X-CouchDB-Body-Time: 0
{"error":"method_not_allowed","reason":"Only GET allowed"}
```
Technically, we should return HTTP 404 for the first case, not ask to
repeat with the GET to fail with HTTP 500 after.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---