1

does karate support send an array of parameter in URL param as one of my API was working as this way. Below was one of my API test url concept. It working fine when i do manually on postman. Not sure whether karate support this kind of format or not.

https<URL>?param={"firstname":"XXX","lastname":"XXX"....}

i have tried with param and params. however params will give me & instead of ,. while in param , it will show ?param=%7B%firstname%22%3A%22abc...

1 Answer 1

2

Karate can support it, I am still not clear what your request is from your question but let me try. Note that as per the HTTP spec - some special characters WILL be URL-encoded.

Try these:

And param param = '{"firstname":"XXX","lastname":"XXX"}'
And param firstName = ['XXX', 'XXX']

See this demo example for more ideas: params.feature

EDIT: if you need to create dynamic JSON that is possible, please read the docs for the set keyword. And below the JSON is being converted to a string - because that is what it looks like from your description (which I really doesn't make sense to me)

* set data
| path      | value |
| firstName | 'XXX' |
| lastName  | 'XXX' |
* string data = data
* param param = data
Sign up to request clarification or add additional context in comments.

2 Comments

i can't use the second solution due to there is a lot of different parameter being put into an array with comma delimeter. Then that array should be put into a param. Sorry for my bad explanation. I will show an example to you how my api work. https://<URL>?param={"firstname":"xxx","lastname":"zzz","address":"abc","phoneNumber":123456,"state":"LA","country":"us"}
@ezwan sorry, I'm the author of Karate and I give up. it looks like a terribly designed API. hope somebody else is able to help you. made one edit to my answer anyway. all the best

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.