Skip to content
Playground(another site)

bynk.test.asset_address_method

Error A suite fetches an asset with a method other than GET; the platform serves assets to GET and answers other methods with 405.

An asset is served by the platform before the Worker runs, and only to GET: it answers every other method with 405. A case fetches one with api.GET(asset), and a different method is refused, since the answer would be the platform's 405 and nothing your code decides. Use GET, and pass the asset alone. A by clause on the fetch is bynk.test.principal_on_asset.

Example

demo/web.bynk
asset style = "assets/board.css"
// tests/web.test.bynk
let r <- api.POST(style) // ✗ only `GET` fetches an asset
let r <- api.GET(style) // ✓

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.asset_address_method shows the same from the installed toolchain, without a network.