zerocode icon indicating copy to clipboard operation
zerocode copied to clipboard

[TECH-DEBT] - Handle multivalue support for www urlencoded header

Open authorjapps opened this issue 7 years ago • 13 comments

This is a tech-debt ticket. Before implementing, please check if the framework(Apache Http Client) is already taking care of this situation. If not, then implement it and raise a PR. TODO-

  • Add an end point or use the existing end point in the Spring Boot demo repo to reproduce this
    • See the relevant repo/class in the below section
  • Add a simple brand new test-case with couple of Key-Values to the above repo
  • Please take care of "body" and "queryParams" while fixing the same.
    • The fix is similar for both. You might reuse the same code.

Spring boot repo: https://github.com/authorjapps/spring-boot-integration-test

Controller class: https://github.com/authorjapps/spring-boot-integration-test/blob/master/src/main/java/com/springboot/controller/CustomerController.java

Relevant comments from the old ticket: Comment Link: https://github.com/authorjapps/zerocode/issues/141#issuecomment-432700435

That sounds correct. 👍 This will make everyone's life a lot easy now. Postman accepts both as key-value and combines them if both are present(shown below).

Folks, Let's go with PR review n approval please !

postmna_body

  • Then in server app- postman_rq_rcvd

If same key is present, they server receives as multivalue(means client also sends as multi value) - see below:

  • postman client postman_2vals

  • spring boot server postman_2vals_server

@arunvelusamyd , Good job mate ! Have you taken care of the above(same key situation) in your PR ? If not can you please take care now ? 👍

@macrocks , @cooljavadev @nirmalchandra - Please review n approve -or- express your view points if disagree or think any other way 🙏

authorjapps avatar Nov 02 '18 11:11 authorjapps

@authorjapps May I work on this?

pgmpofu avatar Mar 02 '19 01:03 pgmpofu

Yes, sounds good. 👍

Greetings and Welcome, Thanks for your interest in contributing.

  • Mailing list - Can you please join the mailing list?

    • https://groups.google.com/forum/#!forum/zerocode-automation
  • Please visit this(2min read) CONTRIBUTION guidelines page

    • https://github.com/authorjapps/zerocode/blob/master/CONTRIBUTING.md
  • Gitter link acts as QnA forum currently, until we have all members in the mailing-list above(newly created)

    • https://gitter.im/zerocode-testing/help-and-usage

Cheers

authorjapps avatar Mar 02 '19 08:03 authorjapps

@authorjapps I apologize for the inconvenience but I am unable to work on this due to other commitments. Please feel free to reassign.

pgmpofu avatar Mar 26 '19 06:03 pgmpofu

No worries. Thanks for letting us know. 👍

authorjapps avatar Mar 26 '19 12:03 authorjapps

@authorjapps is this issue still relevant? May I work on it?

oiakinat avatar May 26 '19 13:05 oiakinat

Hello @oiakinat mate, I have added more details(springboot repo, controller class) to the description now. Yes please, you can kindly pick this.

And thanks for your participation in contributing!

And if you could please join these-

  • Mailing list - Can you please join the mailing list?

    • https://groups.google.com/forum/#!forum/zerocode-automation
  • Please visit this(2min read) CONTRIBUTION guidelines page

    • https://github.com/authorjapps/zerocode/blob/master/CONTRIBUTING.md
  • Gitter link acts as QnA forum

    • https://gitter.im/zerocode-testing/help-and-usage

Cheers

authorjapps avatar May 29 '19 06:05 authorjapps

@authorjapps Thanks a lot for this great opportunity) I've already done all these instructions and some research with fixes. So, I've figured out that SpringBoot recognize same key from query parameters and HttpEntity as it was described in comments from #141 For example, ZeroCode JSON with these objects

"queryParams": {
	"notArray": "notOne"
}, "body": {
	"notArray": "notTwo"
}

will be recieved by SpringBoot as {notArray=[notOne, notTwo]}

But I guess it'll be nice, if we could use arrays in "queryParams" and "body", because now, if we'll try to send something like this

"queryParams": {
	"array": ["one", "two"]
}, "body": {
	"array": ["three", "four"]
}

SpringBoot will receive {array=[[one, two],[three,four]]}. So I've fixed it, and now ZeroCode support multivalue not only for www-urlencoded header.

If it's ok, can I raise a PR? Or if it's not ok - could you please tell where I've got it wrong?

Also, I have to say that in my fix I can't see really good way to control value duplicates, but should we really do this?

oiakinat avatar May 29 '19 07:05 oiakinat

Solution sounds great. Thank you. We are only worried if it won't be backward compatible or break anything for our existing users. Because looks like we are changing the earlier contract!

We are reviewing this and will come back here soon. @arunvelusamyd @santhoshTpixler @macrocks @aghorpade @officiallysameer @respondsid

authorjapps avatar Jun 04 '19 06:06 authorjapps

Mixing the parameters in the URL(AKA queryParameters) and the body parameters will introduce more confusion. It is better to have a clear separation between the URL and the body.

santhoshTpixler avatar Jun 05 '19 07:06 santhoshTpixler

I agree, but in my comment using "queryParams" and "body" together, just a demonstration. Of course, they can be used separately - my idea was to give an additional opportunity to use arrays for params both in "queryParams" and in "body".

oiakinat avatar Jun 05 '19 07:06 oiakinat

@authorjapps Hello! I am interested in working on this issue. Is anyone working on this?

priya1712d avatar Jan 22 '22 00:01 priya1712d

@priya1712d , please go ahead and raise a PR for this when ready.

Please have a look here for CONTRIBUTING: https://github.com/authorjapps/zerocode/blob/master/CONTRIBUTING.md

authorjapps avatar Feb 26 '22 15:02 authorjapps