Skip to content

Dynamic URL rendering issue #1007

Description

@savyovinicius

Bug report

Environment

  • Operating System: Ubuntu 24.04.4 LTS
  • Python version: 3.12.3

Description of the bug

When a node in the endpoint's path has part of its name hardcoded and part set by environment variable, the rendered URL ignores the hardcoded part, keeping just the dynamic one. This leads to requests pointing to the wrong path and causing test errors.

Example:
scanapi.yaml:

endpoints:
  - name: snippets-api
    path: https://demo.scanapi.dev/api/v1/
    headers:
      Content-Type: application/json
    requests:
      - name: health
        method: get
        path: /heal${PATH_COMPLEMENT}/

With export PATH_COMPLEMENT=th, the expected result would be:

INFO     HTTP Request: GET https://demo.scanapi.dev/api/v1/health/

Instead, the tool renders the URL ignoring the initial "heal" part of the node name and only collects the dynamically set value:

INFO     HTTP Request: GET https://demo.scanapi.dev/api/v1/th/

How to reproduce the bug ?

Just need to create the scanapi.yaml as shown above, set the environment variable, and run it using scanapi's version 2.13.2.
Didn't test if the same issue happens in older versions.

Anything else we need to know?

Note: couldn't find anywhere mentioned if this is an expected way of using the variables, however I found out this bug while using the scanapi from openapi tool that generated tests with this pattern.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingNeeds TriageNeeds triage from the maintainer or core devs.Stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions