authorjapps / zerocode

A community-developed, free, opensource, automated testing framework for microservices APIs, Kafka(Data Streams) and Load testing. Zerocode Open Source enables you to create, change and maintain your automated test scenarios via simple JSON or YAML files. Visit documentation below:
https://zerocode-tdd.tddfy.com
Apache License 2.0
906 stars 399 forks source link

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

Open authorjapps opened 6 years ago

authorjapps commented 6 years ago

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-

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

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

@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 🙏

pgmpofu commented 5 years ago

@authorjapps May I work on this?

authorjapps commented 5 years ago

Yes, sounds good. 👍

Greetings and Welcome, Thanks for your interest in contributing.

Cheers

pgmpofu commented 5 years ago

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

authorjapps commented 5 years ago

No worries. Thanks for letting us know. 👍

oiakinat commented 5 years ago

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

authorjapps commented 5 years ago

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-

Cheers

oiakinat commented 5 years ago

@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?

authorjapps commented 5 years ago

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

santhoshTpixler commented 5 years ago

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.

oiakinat commented 5 years ago

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".

priya1712d commented 2 years ago

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

authorjapps commented 2 years ago

@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