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.

Using {{ variable }} as Int variable

See original GitHub issue

I can’t do that

"sender_id": {{ fbID }}, as it complains on an invalid json.

Doing this "sender_id": "{{ fbID }}", fails the API, as now the number is a string.

Any solution for this ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hassycommented, May 25, 2018

The most recent version of Artillery will now preserve the type of the variable rendered by a template if that’s the only operation in that template, so in the something like the following:

    flow:
      -
        post:
          url: "/api/v1/something/{{ id }}"
          json:
            id: "{{ id }}"

If id = 42, the resulting JSON payload sent to the target will be:

{"id": 42}

@tiffanywilson Mind opening another issue about the custom JS stuff? very curious

1reaction
hassycommented, Apr 4, 2018

that’s a great solution @jordandlaman, we’ll prioritize getting this sorted properly without needing to resort to writing custom JS

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# Variables - W3Schools
Variables are containers for storing data values. In C#, there are different types of variables (defined with different keywords), for example: int -...
Read more >
Variables and types - CPlusPlus.com
These are two valid declarations of variables. The first one declares a variable of type int with the identifier a . The second...
Read more >
Integer (Int Variable) in Python - OpenGenus IQ
Integer variables, or "int" variables, are variables that specifically store, as the name suggests, integers as its value. As such, all whole numbers...
Read more >
How can I use a int inside a variable name? - Stack Overflow
1-This code is getting the class named "MyClass". new MyClass().getClass() · 2-Accessing the field with the same name as the string that I ......
Read more >
Variables -- declaring and assigning values
int Most commonly used form of integer variable, 32 bits. May hold any value in the range -2147483648 to 2147483647. long Used if...
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