Unable to return numeric values in response.

29 views
Skip to first unread message

אלדד אוזמן

unread,
Jan 4, 2020, 1:15:11 PM1/4/20
to hoverfly
Hi all!

I've been experimenting with HF for a few days and it looks awesome!
However, I couldn't find any way to return numeric values in the response.

For example:

"response": {
"status": 200,
"body": "{\"something\":\"{{ randomInteger }}\"}",
"encodedBody": false,
"templated": true
}

In this response object, the body contains a random number integer, but it is not returned as an integer but rather a string because of the apostrophes.

removing the apostrophes would lead to the actual string {{randomInteger } being returned (and that would be an invalid json object.

What would you suggest?

If there's any further guides to read, do send :)


Thanks!

Tommy Situ

unread,
Jan 6, 2020, 3:35:20 AM1/6/20
to אלדד אוזמן, hoverfly
Hi, 

You can try removing the double quotes surrounding the template function. It should become a number.

BR,
Tommy

On 4 Jan 2020, at 6:15 pm, אלדד אוזמן <eldad...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "hoverfly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoverfly+u...@specto.io.
To view this discussion on the web visit https://groups.google.com/a/specto.io/d/msgid/hoverfly/2c9102a4-1326-4835-9051-88119a02e916%40specto.io.
Reply all
Reply to author
Forward
0 new messages