Skip to content
Playground(another site)

bynk.test.principal_on_wrong_method

Error A wrong-method 405 test carries a by <Actor> clause; it reaches no handler, so a principal is meaningless.

A wrong-method test, such as DELETE on a path declared only for GET, expects the 405 the router returns before any handler is chosen. No handler runs, so there is no actor to act as, and a by clause would suggest otherwise. Drop the by clause. To test who may call a route, address a method it does declare.

Example

tests/api.test.bynk
let r <- api.DELETE("/a") by User("bob") // ✗ no handler runs
let r <- api.DELETE("/a") // ✓
expect r is Rejected(MethodNotAllowed)

In the Book

See also

  • The grammar rule it governs: case.
  • Every code in its category, Tests, on the diagnostic index.
  • bynk explain bynk.test.principal_on_wrong_method shows the same from the installed toolchain, without a network.