How encode symbol '?' in path?
aleks-noname opened this issue · comments
Hello!
I can't found answer on docs and examples.
I need to output content of wsdl file and I successfully use follow config:
plugin: rest
path: /data/wsdl
method: GET
contentType: "text/plain"
response:
file: my_file.wsdl
But I need to use follow path:
/data?wsdl
If I write it as is I got error:
Resource not found
No resource exists for:
GET /data
The available REST resources are:
GET /data?wsdl
Also I tried follow tricks:
/data\?wsdl
/data%3Fwsdl
unfortunately it didn't help me.
Please help me to understand where is my error.
Hello @aleks-noname
The ?wsdl is a query parameter and is not part of the resource as such.
You must therefore put your condition on the query parameter part.
This is documented on the "Conditional responses" chapter of https://docs.imposter.sh/configuration/
The tricky part is that this "wsdl" query parameter is not getting a value and we are simply looking for its "existance".
Here is an example of what will work.
plugin: rest
resources:
- method: GET
path: /data
queryParams:
wsdl: ""
response:
file: my_wsdl.wsdl
Just in case you don't know, @outofcoffee added the basePath property that may make you configuration neat at it grows.
So here is the equivalent:
plugin: rest
basePath: /data
resources:
- method: GET
path: /
queryParams:
wsdl: ""
response:
file: my_wsdl.wsdl
Best regards,
Pierre
Thank you for fast answer! :)
it's work for me.