This question already has answers here:
What is %2C in a URL?
(8 answers)
Closed 11 months ago.
In this API link, what is the meaning of '%2C'
https://maps.googleapis.com/maps/api/place/details/json
?fields=name%2Crating%2Cformatted_phone_number
&place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
&key=YOUR_API_KEY
Reference: I want to create custom APIs from here: https://developers.google.com/maps/documentation/places/web-service/details#maps_http_places_details_fields-txt
%2C is url encoded for ,
URL encoding
Related
This question already has an answer here:
Karate: Is there a way of getting JSON object keys length from an Examples variable?
(1 answer)
Closed 1 year ago.
In Karate framework using Visual studio, I am making a REST call. I need to get the response size in KB or MB.
I tried these:
print response.size
Response: [jdk.dynalink.beans.SimpleDynamicMethod int java.util.HashMap.size()]
print response.length
Response: 6
This is the # of nodes of the response (items,hasMore,count,limit,offset,links)
print responseHeaders
Response: This gives me the response headers. It does not have response size
Can someone suggest a way to get the response size?
The responseBytes will contain the raw bytes and you can get the JavaScript length property like this:
* print 'size:', responseBytes.length
Note that I am using Karate version 1.X
This question already has an answer here:
Passing JSON request starting with the character [ gives the error: invalid request format with GET operation [duplicate]
(1 answer)
Closed 2 years ago.
I'm attempting to send a simple POST request and struggling slightly.
Postman data request shown
--data-raw '""'
Given url TESTURL
And request '""'
When method post
Then status 200
A 500 response is returned every time, this works in postman. What am I missing?
Try adding a header
* header Content-Type = 'text/plain'
This question already has answers here:
How should I validate an e-mail address?
(35 answers)
Closed 3 years ago.
I'm trying to handle error cases in my android app while signing up users. I want to make sure the email address provided is valid and by valid I mean the correct format : "something#something.com".
I have searched on google and stackoverflow, but couldn't find an exact answer in Kotlin.
Based on this answer in java (How should I validate an e-mail address?), you can use extension function to check the validity in kotlin.
fun String.isEmailValid(): Boolean {
return !TextUtils.isEmpty(this) && android.util.Patterns.EMAIL_ADDRESS.matcher(this).matches()
}
and then call
val str = ""
str.isEmailValid()
This question already has an answer here:
How to compare 2 JSON objects that contains array using Karate tool and feature files
(1 answer)
Closed 1 year ago.
I want to create a re-usable feature which can be called by other feature files and that re-usable feature file should accept different json payloads
I want the analyticPayload to accept json file which is passed from createAnalytic.feature
1) createAnalytic.Feature -->
Given url xyz
And headers abc
And header Content-Type = 'multipart/form-data'
And multipart field analytic = analyticPayload
And multipart file file = templateJar
When method POST
Then status 200
2) createAnalytic.Feature -->
Scenario Outline:
* def analyticEntry= call read('classpath:tests/commonFeatures/createAnalytic.feature') {analyticPayload:<analyticPayload>}
Examples:
|analyticPayload|
|read('classpath:payloads/analyticCreation/createPowerAnalytic.json')|
Getting the error : :1:97 Missing close quote
com/ge/KraftTests/commonFeatures/createAnalytic.feature') {analyticPayload:powerAnalyticTemplate}
^ in at line number 1 at column number 97
that re-usable feature file should accept different json payloads
In my opinion, no it should not. Can you please read this answer carefully - and if you still want to go down this path, open a new question.
https://stackoverflow.com/a/54126724/143475
This question already has answers here:
How to get the downloaded xlsx file from the api endpoint in karate?
(2 answers)
Closed 1 year ago.
I am trying to confirm the file downloaded from an api. After reviewing the recommendation from How to test download api using karate, my scenario was written like below:
Scenario: GET /project - Export project listing
Given params { someparam: 'paramvalue' }
When method GET
Then status 200
And match header Content-Disposition == 'attachment;filename="someFile.xlsx"'
And match header Content-Type == 'application/vnd.ms-excel'
And match response == read('data/exported.xlsx')
The first 2 matches pass. However, the last match (comparing the actual file) fails with a binary printout of both files and "reason: not equal".
The file "exported.xlsx" in the comparison was the output of the exact same request done via Postman, so they should match.
Is read() able to handle excel and csv files? Any help would be appreciated.
As far as I know this should have worked. read('data/exported.xlsx') will return a stream of bytes.
If this is indeed a bug you will do a great service to the community if you follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue