Kanika
Kanika

Reputation: 33

How to pass string and file as input for form parameters in a POST method using Karate

I am trying to call a POST method which accepts the below form parameters

Path – A string specifying the path FileName - A binary file Media Type: multipart/form-data

Below code helps with the binary file part Given multipart file xxx= { read: 'classpath:xxx', filename: 'xxx'}

However, in the same request I need to pass the string parameter as well.

Please suggest a way.

Thanks, Kanika

Upvotes: 1

Views: 912

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

You can combine multipart field with multipart file, refer to this demo example also.

Given multipart file xxx = { read: 'classpath:xxx', filename: 'xxx' }
And multipart field yyy = 'myvalue'

Upvotes: 2

Related Questions