E07690: HTTP access verb not supported in this context

Category: E07xxx Full resolution · Reported in phase: SYMBOL_DEFINITION · Classification: SERVICE_HTTP_ACCESS_NOT_SUPPORTED · All error codes

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

  1. Read the value in the HTTP method (its parameter keeps the marker)
  2. 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

  • E07690: an HTTP access marker on a method that is not an HTTP endpoint (this error)
  • E07700: invalid path parameter format

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:

Found a problem?

If EK9 reported E07690 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.