E07700: HTTP PATH parameter is invalid
What went wrong
The HTTP path parameter format is invalid.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 658 (How do I extract path parameters in EK9 services?)
How to fix it
- Use {variableName} format for path parameters
- Ensure path is valid URI format
Common causes
- Missing braces around variable
- Invalid characters in path
- Malformed URI pattern
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07700: HTTP PATH parameter is invalid
#!ek9 defines module error.e07700.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 byId() as GET for :/{address-id} -> //There is no {no-such-path} in the URI addressId as Integer :=: PATH "no-such-path" <- response as HTTPResponse: TextResponse(`address ${addressId}`)
Fixed: Name the URI's variable
#!ek9 defines module error.e07700.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 //Name the URI variable exactly byId() as GET for :/{address-id} -> addressId as Integer :=: PATH "address-id" <- response as HTTPResponse: TextResponse(`address ${addressId}`) //Or name the parameter as the variable, and PATH is implied byRoute() as GET for :/route/{routeId} -> routeId as String <- response as HTTPResponse: TextResponse(`route ${routeId}`)
Questions and answers
These Q&A entries show E07700 and its fix:
Found a problem?
If EK9 reported E07700 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.