Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong comment? #16

Closed
Guid75 opened this issue Feb 3, 2023 · 1 comment
Closed

wrong comment? #16

Guid75 opened this issue Feb 3, 2023 · 1 comment

Comments

@Guid75
Copy link

Guid75 commented Feb 3, 2023

// Select the first parameter value
reqPart[paramKey] = paramValue[paramValue.length-1];

As far as I understand, this selects the last parameter value.
Is the comment wrong or the assignement itself?

@analog-nico
Copy link
Owner

Thanks! You are right.

Fyi, the unit test ensures that the last value is chosen:

hpp/test/spec/hpp.js

Lines 103 to 118 in cdf0bab

it('with two same parameters but different value', function () {
return rp(echoServer.url + '/search?firstname=John&firstname=Alice')
.then(function (data) {
expect(data).to.eql({
query: {
firstname: 'Alice'
},
queryPolluted: {
firstname: [ 'John', 'Alice' ]
},
body: {}
});
});
});

analog-nico added a commit that referenced this issue Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants