Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST/PUT json body - red colour syntax highlighting when using variables outside strings is confusing #1319

Open
nbarnwell opened this issue Nov 1, 2024 · 0 comments

Comments

@nbarnwell
Copy link

  • REST Client Version: v0.25.1
  • VSCode/OS Version: Version: 1.94.2 (system setup)
    Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
    Date: 2024-10-09T16:08:44.566Z
    Electron: 30.5.1
    ElectronBuildId: 10262041
    Chromium: 124.0.6367.243
    Node.js: 20.16.0
    V8: 12.4.254.20-electron.0
    OS: Windows_NT x64 10.0.22631

Steps to Reproduce:

  1. Choose an API that returns an object with boolean properties, for which there are GET and POST/PUT operations (so you can GET the object, then PUT it back with a minor change).
  2. Build a GET request that returns the object in the body.
  3. Build a PUT request that sends a matching object, where the values from the GET result are used. See example:

Example

{
  "subject": "{{user.response.body.subject}}",
  "username": "{{user.response.body.username}}",
  "email": "{{user.response.body.email}}",
  "firstName": "{{user.response.body.firstName}}",
  "lastName": "{{user.response.body.lastName}}",
  "isBlocked": true,
  "lockoutEnd": {{user.response.body.lockoutEnd}},
  "lockoutEnabled": {{user.response.body.lockoutEnabled}},
  "isDeleted": {{user.response.body.isDeleted}},
  "twoFactorEnabled": {{user.response.body.twoFactorEnabled}},
  "claims": {{user.response.body.claims}},
  "roles": {{user.response.body.roles}}
}

Result
The properties that are not strings enclosed in quotes are syntax-highlighted in red, which misled the idiot writing this issue into thinking the request was malformed and would not work. When I tried it and had problems, I mistakenly thought the syntax was wrong and spent a while working out what what the real problem was.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant