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.

Access query parameter that contain square brackets using handlebars template

See original GitHub issue

Hi, there is a need to get query parameter that contain square brackets in template eg: localhost:8080/some_url/?filter[order_id]=123 I need to get value of filter[order_id], valid handlebars template for it is: "{{ request.query.[filter[order_id\]] }}" checked here http://tryhandlebarsjs.com/

my JSON API request: {"request": {"urlPath": "/some_url/", "method": "GET"}, "response": {"body": "{{ request.query.[filter[order_id\\]] }}", "status": 200, "transformers": ["response-template"]}}

but get 500 on request accessing this stub: wiremock.com.github.jknack.handlebars.HandlebarsException: inline@7c8b8743:1:17: found: '[filter[order_id\' {{ request.query.[filter[order_id\]] }}

how can I get this query parameter?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:9

github_iconTop GitHub Comments

1reaction
tomakehurstcommented, Apr 17, 2020

Here’s how you do it:

{{lookup request.query 'filter%5Border_id%5D'}}

(EDITED: [ and ] need to be escaped)

0reactions
chitharanjanITcommented, Dec 7, 2021

My requirement is to read a query parameter with dotcriteria.coverType

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access query parameter that contain square brackets ... - GitHub
Hi, there is a need to get query parameter that contain square brackets in template eg: localhost:8080/some_url/?filter[order_id]=123
Read more >
Expressions | Handlebars
Handlebars expressions are some contents enclosed by double curly braces {{}} . In the below template, firstname is a variable that is enclosed ......
Read more >
square bracket array access and handlebars template
I'm working on a node project with handlebars tempting engine. I have a very large object I need to represent in a table....
Read more >
Query Criteria, Part 3: Prompting for input by using a parameter
Make a query ask for input by using a parameter by using a criteria prompt. You add the prompt in square brackets in...
Read more >
Personalizing Templates with Handlebars
To use Handlebars to reference a field that contains spaces or a period, or starts with a number, surround the field in square...
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