Skip to content

baseUri without trailing slash results in malformed request URLs #184

@farah-t-trigui

Description

@farah-t-trigui

Component

Protocol Adapters (MCP, SKILL, REST…)

Description

Actual behavior:
When baseUri does not end with a /, the constructed request URLs are incorrect due to improper concatenation.
This results in invalid endpoints such as:

https://api.notion.com/v1pages

Expected behavior:
The framework should:

either automatically normalize baseUri (append the missing /),
or clearly document that a trailing / is required,
or throw an explicit validation error.

Steps to Reproduce

  1. Create a capability.yml file with:
naftiko: "0.5"
capability:
  exposes:
    - type: "rest"
      port: 8081
      namespace: "sample"
      resources:
        - path: "/notion/{{path}}"
          description: "This resource forwards requests to the Notion API, allowing access to any Notion endpoint by specifying the path parameter. For example, a request to /notion/pages would be forwarded to https://api.notion.com/v1/pages."
          forward:
            targetNamespace: notion
            trustedHeaders:
            - Notion-Version

  consumes:
    - type: "http"
      description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API"
      namespace: "notion"
      baseUri: "https://api.notion.com/v1/"
  1. Start the runtime (Docker or JVM)
  2. Call:
    GET http://localhost:8081/notion/pages
  3. Observe the generated backend request URL

Capability File (if relevant)

naftiko: "0.5"
capability:
  exposes:
    - type: "rest"
      port: 8081
      namespace: "sample"
      resources:
        - path: "/notion/{{path}}"
          description: "This resource forwards requests to the Notion API, allowing access to any Notion endpoint by specifying the path parameter. For example, a request to /notion/pages would be forwarded to https://api.notion.com/v1/pages."
          forward:
            targetNamespace: notion
            trustedHeaders:
            - Notion-Version

  consumes:
    - type: "http"
      description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API"
      namespace: "notion"
      baseUri: "https://api.notion.com/v1/"

Logs & Stacktrace

Run HTTP_STATUS=$(curl -s -o /tmp/step2_response.json -w "%{http_code}" \
HTTP status: 400
Response body:
{"object":"error","status":400,"code":"invalid_request_url","message":"Invalid request URL.","request_id":"e447c84e-74e8-4817-9a1c-01d0d5a1e870"}Unexpected HTTP status: 400
Couldn't find any helper support the HTTP_Bearer challenge scheme.

Version

v1.0.0-alpha1

Runtime

Docker

Agent Context (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions