Rest - Parameter that is optional and empty value
Hello,
We have a rest web service that we would like to test.
Let's say that this web service has a parameter called 'type'. I have the following use cases:
[1] the parameter is optional and you don't specify it :
- it must return all the entities, whatever their type value is.
- The request is looking like this : GET http://localhost/service/
[2] you specify the parameter with an empty value :
- it must return all the entities that have an empty value for type.
- The request is looking like this : GET http://localhost/service/
[3] you specify the parameter with a given value :
- it must return all the entities that have the given value for type.
- The raw request is looking like this : GET http://localhost/service/?type=theValue
As you can see, use cases [1] and [2] are different, yet the request is the same. I would like [2] to have the following request: GET http://localhost/service/?type=
Here are some things that I have read on other posts, but I havn't been able to make it work :
- I tried to set the type parameter as required, but then it is use case [1] that is not working anymore ;
- I tried to use %00 or %80 or nbsp; and tweaking with the request properties such as "Strip whitespaces", "Remove Empty Content", "Entitize Properties"
Can someone help me on this problem ?
Is there a built-in way to make it work ? Do I need to use a script ?
Thank you !
Clone your resource or method. Set the parameter as Required for one of the copies and not Required on the other.