I need to replace dynamic value 'tenantID' for multipart data input json file. I need to a way to replace a value for multipart input json file. Below code shows the details:
* def tenantID = '2345';
* configure charset = null
Given multipart file properties = { read: 'classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }
Given multipart file appIcon = { read: 'classpath:ic/feature/REST/TestDataGlobal_Weather.png', filename: 'Global_Weather.png', contentType: 'image/png' }
When method post
In the above code I need to replace the 'tenantID' in the 'linkedInOauth2RESTInput.json' file . Since this is multipart input i am not understanding how to replace its content.
Waiting for response. Thanks in Advance
Write a Java utility to modify the file
linkedInOauth2RESTInput.json
before you do the upload. You can use thefile:
prefix instead ofclasspath:
, so I recommend you save the temp file into thetarget
folder, then you can do this:But I agree that this is complicated, so I'm making a change to Karate so that you can instead of
read
, pass avalue
.EDIT: this might also work depending on the server in this case: