E07690: HTTP access verb not supported in this context
What went wrong
A parameter of a method that is NOT an HTTP endpoint carries an HTTP access marker (':=: CONTENT', ':=: PATH', ':=: QUERY "q"', ':=: HEADER "h"', ':=: REQUEST', ':=: CONTEXT'). Only a service's HTTP methods and operators receive a request, so only their parameters can be read from one. A private helper of a service takes ordinary parameters.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 1323 (Why does EK9 reject an HTTP access marker (:=: PATH) o...)
How to fix it
- Read the value in the HTTP method (its parameter keeps the marker)
- Pass it to the helper as an ordinary parameter (no ':=:' marker)
The [EXAMPLE] section below shows a private helper whose parameter reads CONTENT, and the POST method taking the CONTENT and passing it to the helper.
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07690: HTTP access verb not supported in this context
#!ek9 defines module error.e07690.bad defines class TextResponse with trait of HTTPResponse text as String? default private TextResponse() TextResponse() -> body as String this.text: body override contentType() as pure <- rtn as String: "text/plain" override content() <- rtn as Bytes: Bytes().withUtf8(text) override status() as pure <- rtn as Integer: 200 default operator ? defines service Addresses for :/addresses open create() as POST for :/ -> incoming as String :=: CONTENT <- response as HTTPResponse: TextResponse(normalise(incoming)) //Not an HTTP method, so there is no request to take CONTENT from private normalise() -> text as String :=: CONTENT <- rtn as String: text.trim()
Fixed: Bind HTTP values only on the HTTP method
#!ek9 defines module error.e07690.good defines class TextResponse with trait of HTTPResponse text as String? default private TextResponse() TextResponse() -> body as String this.text: body override contentType() as pure <- rtn as String: "text/plain" override content() <- rtn as Bytes: Bytes().withUtf8(text) override status() as pure <- rtn as Integer: 200 default operator ? defines service Addresses for :/addresses open //The HTTP method takes the CONTENT... create() as POST for :/ -> incoming as String :=: CONTENT <- response as HTTPResponse: TextResponse(normalise(incoming)) //...and passes it to a helper with an ordinary parameter private normalise() -> text as String <- rtn as String: text.trim()
Questions and answers
These Q&A entries show E07690 and its fix: