james-proxy / james

Web Debugging Proxy Application
1.42k stars 124 forks source link

"Request Query Params" use multiple parameters to display errors #399

Closed loveyu closed 5 years ago

loveyu commented 5 years ago

eg: property_id=123&property_id=456

error display:

property_id: 123456

suggest:

property_id: 123
property_id: 456
mitchhentges commented 5 years ago

In the case of multiple query parameters with the same name, they're in more of an array form. I'm thinking of having this print like:

property_id: 123,456
loveyu commented 5 years ago

We came across a situation where the passed arguments are of the form but not an array.

property_id=19248&property_id=20321

NOT Like:

property_id[]=19248&property_id[]=20321

If I use array form, I won't be able to pass parameter validation, this is limited by third-party APIs.

However, this is just a display issue and does not cause any exceptions.

mitchhentges commented 5 years ago

Ah, yes, I understand, I didn't explain properly. I mean, if you have a URL like: http://website.com/endpoint?property_id=123&property_id=456, then I want to display it like:

property_id: 123,456

Does that sound good?

loveyu commented 5 years ago

I feel like referring to the Chrome browser example, https://www.example.com/?property_id=123&property_id=456&property_ids[]=789&property_ids[A]=000

Display:

property_id: 123
property_id: 456
property_ids[]: 789
property_ids[A]: 000

When the array becomes multi-dimensional, the situation may be more complex if merged display is used.

mitchhentges commented 5 years ago

Hmm, good point. Right now, our underlying proxy that provides us the data is the tool that parses the query parameters, as viewed in the docs here. It's the underlying proxy that handles ?property_id[0]=123&property_id[1]=456 and ?property=123&property=456 differently:

// hoxy
// ?property_id[0]=123&property_id[1]=456
{
    'property_id[0]': 123,
    'property_id[1]': 456
}

// ?property=123&property=456
{
    'property_id': [123, 456]
}

We have a couple solutions to this:

loveyu commented 5 years ago

Display to property_id: [123, 456], the most direct solution. I think the first thing is not to be misleading, the display mode can be flexible.

mitchhentges commented 5 years ago

I've made a follow-up for this ticket, but since the core issue has been addressed, I'll close this.