resolve icon indicating copy to clipboard operation
resolve copied to clipboard

Obscure error when defining two API-handlers with the same name and same method

Open FreeSlave opened this issue 3 years ago • 0 comments

Describe the bug If two api-handlers share both the same endpoint name and the same http method (e.g. POST), the application fails on start with the error "POST" already defined.

{
  path: '/api/pause-replication',
  handler: 'common/api-handlers/pause_replication.js',
  method: 'POST',
},
{
  path: '/api/pause-replication',
  handler: 'common/api-handlers/resume_replication.js',
  method: 'POST',
},

Expected behavior The error message must include both http method name and endpoint name to be more clear. The original error text comes from route-trie module. If possible, the check must be done at the build phase, not at runtime.

FreeSlave avatar Apr 22 '21 09:04 FreeSlave