hoverfly
                                
                                 hoverfly copied to clipboard
                                
                                    hoverfly copied to clipboard
                            
                            
                            
                        Multiple entries of the same query parameter are encoded using ; (semicolon)
Description of the bug
In commit 1276c03cf5315658bc14c87c504b68d58ba03258 (PR #794), we fixed #792. However, the fix is still not optimal since query parameters where either part of the key=value part includes semicolon will be unable to be represented in the simulation JSON.
To be honest, my use case don't have a requirement to use semicolons at the moment. However, I see a risk with the current implementation in that it uses a separator which could potentially be a fully valid part of a query parameter for a "reserved" purpose like this. This could potentially be very confusing to our users.
Ideally, the values would be present multiple times in the JSON (i.e. no separator), but if this is considered too complex/time consuming, we should at the very least choose a separator which is more than a single character. ;;; would be an improvement (note, this is just a suggestion; feel free to come up with a better option if you like)
Steps to reproduce the issue
Make a query which includes the same query string multiple times. Like this: http://localhost/some-api/some-resource?q=access:vod&q=order:latest&q=profile:vd
Observed result
"q": [
    {
        "matcher": "exact",
        "value": "access:vod;order:latest;profile:vd"
    }
Hoverfly error messages seen (If none, say none)
none
If possible, add screenshots to help explain your problem
Expected result
"q": [
    {
        "matcher": "exact",
        "value": "access:vod;;;order:latest;;;profile:vd"
    }
or (preferably):
"q": [
    {
        "matcher": "exact",
        "value": "access:vod"
    },
    {
        "matcher": "exact",
        "value": "order:latest"
    },
    {
        "matcher": "exact",
        "value": "profile:vd"
    }
or even this (I think this would be my personal favorite, in terms of readability of the JSON):
"q": [
    {
        "matcher": "exact",
        "value": [
            "access:vod",
            "order:latest",
            "profile:vd"
        ]
    }
Additional relevant information
- Hoverfly version:
+----------+--------------+
| hoverctl | master-3141  |
| hoverfly | v1.0.0-rc.2  |
+----------+--------------+
- Anything that might help us to diagnose the problem
Hi @perlun, joining multiple values using a symbol for a query is not a permanent solution, we prefer to implement what you suggest as well:
"q": [
    {
        "matcher": "exact",
        "value": [
            "access:vod",
            "order:latest",
            "profile:vd"
        ]
    }
We thought about this before, and the value field is an interface type in the data model, so that it can be an array.
There will be matcher types that are specific to array values, like contains, containsExactly or containsOnly.
@tommysitu Sounds great! As noted, it's not a huge problem for me at the moment but it was just something we discovered internally when we figured out how it's currently serialized to the JSON.
Btw, thanks for a great product! :+1:
Hi, is this fixed?
Or some way working with queries like: q=access:vod&q=order:latest&q=profile:vd](http://localhost/some-api/some-resource?q=access:vod&q=order:latest&q=profile:vd
@tommysitu I can work on this issue and fix this in above mentioned way. You can assign this issue to me.
@kapishmalik that'll be awesome!
@tommysitu Work is in progress. Can you mark this as WIP or assign this issue to me?
@tommysitu Raised PR
Thanks @kapishmalik your PR looks good!
@tommysitu I feel I need to relook at contains and containsonly matcher. I am confused with existing implementation. I will raise PR to fix those.
@tommysitu can you check this PR and review implementations and if they make more sense now.
Thanks @tommysitu with reviews. I believe we are good with this issue now.
@perlun this is done. You can use and let us know inase of any issues.