1

I tried to write karate script for this below curl request :

curl --location --request POST 'https://xxxx' \
--header 'Authorization: Bearer token' \
--form 'csv=@"/Users/user/desktop/vouchers.csv"'

The Karate Script :

Given path 'voucher'
And header Authorization = token
And multipart file csv = { read: 'file:/Users/user/desktop/vouchers.csv', filename: 'vouchers.csv', contentType: 'text/csv' }
When method post
Then status 200

Did I make a mistake or missing something ? because I kept getting API error response that the csv format is invalid. I also tried using form field, karate.readAsString(), and any other way but still got the same error.

Note: It works fine if I hit from postman using the same file.

alphaaf
  • 11
  • 1

0 Answers0