riok / Kreya

Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
https://kreya.app
284 stars 5 forks source link

Using variables in a REST slug has incorrect values or fails #198

Closed iancullinane closed 5 months ago

iancullinane commented 7 months ago

Describe the bug When trying to use a REST slug with a variable, there seems to be some unexpected behavior. I have a slug that takes a uuid, not a query param. I assumed I could use a variable for this but it appears to be failing, those failures also appear to inject strings that no longer exist.

To Reproduce Steps to reproduce the behavior:

  1. Params on a REST endpoint.
  2. Use a variable in the path (eg /v1/endpoint/{{ vars.uuid }}.
  3. Notice "Path Params" appears with { vars.uuid as the "Key" and nothing for the value.
  4. Call does not have the uuid in the expected position.

Addtionally, and I can't get the kreya environment to stop this behavior now that it has happened.

  1. In "Query Parameters" add a a value (eg "UserId":{{ vars.uuid }}"
  2. Remove that key
  3. Subsequent calls with {{ vars.uuid }} still have the query param (eg v1/user/%7D?%3AownerID=%7D

Expected behavior Using a variable in the slug injects it appropriately.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (if possible, copy the information from the error dialog or the About menu):

  "kreyaVersion": "1.13.1",
  "releaseChannel": "stable",
  "osDescription": "Darwin 21.6.0 Darwin Kernel Version 21.6.0: Thu Jun  8 23:57:12 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_X86_64",
  "osVersion": "Unix 12.6.7",
  "osArch": "X64",
  "processArch": "X64",
  "runtimeIdentifier": "osx-x64",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)"

Context

When adding a variable at the end of the slug the following appears in Path Params, not sure if this is expected:

image

CommonGuy commented 7 months ago

The way this is expected to work is to configure the path as /v1/endpoint/{UserId}. This should make a "UserId" entry appear in the "Path params", whose value you can set to {{ vars.uuid }}.

A similar configuration from the example project:

grafik

I understand that this behaviour is confusing and we'll discuss if we can do anything to improve this.

CommonGuy commented 6 months ago

A fix for this has been implemented and was released with the newest beta release. It will be included in the next stable version.

CommonGuy commented 5 months ago

Kreya 1.14 has been released