question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable env variable placeholder replacement when including file in request

See original GitHub issue

It would be great if env variable placeholders would also be replaced in included files.

// My Env File
{
  "dev": {
    "foo": "bar"
  }
}
// My payload "payload.json" as a separate file
{
  "foo": "{{foo}}"
}
POST my.host.com
Content-Type: application/json

< ./payload.json

Currently, when sending the request, it would send the exact payload and not replace the {{foo}} placeholder.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
daedal-knickerbockerscommented, May 19, 2021

Do you have an example PDF for this?

I tried it out with these two files: Foo.md Converted to PDF: Foo.pdf

I then sent this request:

// Environment
{
  "Foo": {
    "foo": "bar"
  }
}
POST https://httpbin.org/anything
accept: application/json

< ./Foo.pdf

This was the response:

{
  "args": {},
  "data": "data:application/octet-stream;base64,JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7/AE0AYQByAGsAZABvAHcAbgAgAFQAbwAgAFAARABGKQovQ3JlYXRvciAo/v8AdwBrAGgAdABtAGwAdABvAHAAZABmACAAMAAuADEAMgAuADUpCi9Qcm9kdWNlciAo/v8AUQB0ACAANAAuADgALgA3KQovQ3JlYXRpb25EYXRlIChEOjIwMjEwNTE5MDcxMzQzWikKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL0V4dEdTdGF0ZQovU0EgdHJ1ZQovU00gMC4wMgovY2EgMS4wCi9DQSAxLjAKL0FJUyBmYWxzZQovU01hc2sgL05vbmU+PgplbmRvYmoKNCAwIG9iagpbL1BhdHRlcm4gL0RldmljZVJHQl0KZW5kb2JqCjcgMCBvYmoKWzAgL1hZWiAzMyAgCjgxMy41MDAwMDAgIDBdCmVuZG9iago4IDAgb2JqCjw8Ci9fX1dLQU5DSE9SXzIgNyAwIFIKPj4KZW5kb2Jq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Length": "4357",
    "Content-Type": "*/*",
    "Host": "httpbin.org",
    "User-Agent": "Apache-HttpClient/4.5.13 (Java/11.0.10)",
    "X-Amzn-Trace-Id": "Root=1-60a4bb3a-235c5e0f75c06a8b10275ff9"
  },
  "json": null,
  "method": "POST",
  "origin": "...",
  "url": "https://httpbin.org/anything"
}

I built the response PDF file out of the response data and recieved this: Response.pdf

Its the exact same PDF file and no replacement has happened.

Is this what you had in mind as a test? If not, I can test another case 😃

0reactions
AnWebercommented, May 24, 2021

I updated environmentConfig to allow configuration of a white list of extensions which automatically inject variables. I think this simplifies your use case

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to replace ${} placeholders in a text file? - Stack Overflow
Here is a solution from yottatsa on a similar question that only does replacement for variables like $VAR or ${VAR}, and is a...
Read more >
Deck support placeholder replace · Issue #191 · Kong/deck
Hi, is it possible to apply a sort of placeholder substitution into deck sync ... feat(file) implement env var substitution for state files...
Read more >
How to use a YAML file or environment variables to populate ...
Decide where you would like to save the desired credentials or config values - in a YAML file, environment variables, or a combination...
Read more >
Environment variables in Compose | Docker Documentation
Substitute environment variables in Compose files. If you have multiple environment variables, you can substitute them by adding them to a default environment...
Read more >
Using variables | Postman Learning Center
Videos. How to Use Variables in Postman ... Intro to Postman | Chain Requests · Manage CLI Environment Variables | Postman Level Up....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found