wasabifx / wasabi

An HTTP Framework
501 stars 56 forks source link

normalized path when adding a new one to make it reachable #94

Closed Tradunsky closed 7 years ago

Tradunsky commented 7 years ago

Shall it throw an exception instead of normalization?

swishy commented 7 years ago

Hi, thanks for the PR, we can probably just throw an exception here, it will only be a development time thing and the route should be declared properly at the end of the day. For example is TestServer.appServer.get( "unreachable", {}) supposed to actually be "/unreachable" or "/some/other/base/route/unreachable" ?

Tradunsky commented 7 years ago

I had some experiments with spring mvc and they treated "unreachable" and "/unreachable" in the same way without any exceptions.

As for wasabi, it is ok to throw exception, but for the sake of readability: get("books", booksJson) or get("books", returnsAllBooks)

However, I would create a new MR with throwing an exception if you didn't change your mind

swishy commented 7 years ago

Manually merged PR due to conflicts since I merged PR #95 ahead.

Tradunsky commented 7 years ago

Cool, thanks!