how to use embedded expressions for multipart file input in karate












2















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










share|improve this question























  • Hi Peter, I have responded accordingly for those questions now. Please solution for this .

    – Anupama
    Nov 22 '18 at 9:22











  • just made one edit

    – Peter Thomas
    Nov 22 '18 at 9:51
















2















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










share|improve this question























  • Hi Peter, I have responded accordingly for those questions now. Please solution for this .

    – Anupama
    Nov 22 '18 at 9:22











  • just made one edit

    – Peter Thomas
    Nov 22 '18 at 9:51














2












2








2








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










share|improve this question














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







karate






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 9:05









AnupamaAnupama

1398




1398













  • Hi Peter, I have responded accordingly for those questions now. Please solution for this .

    – Anupama
    Nov 22 '18 at 9:22











  • just made one edit

    – Peter Thomas
    Nov 22 '18 at 9:51



















  • Hi Peter, I have responded accordingly for those questions now. Please solution for this .

    – Anupama
    Nov 22 '18 at 9:22











  • just made one edit

    – Peter Thomas
    Nov 22 '18 at 9:51

















Hi Peter, I have responded accordingly for those questions now. Please solution for this .

– Anupama
Nov 22 '18 at 9:22





Hi Peter, I have responded accordingly for those questions now. Please solution for this .

– Anupama
Nov 22 '18 at 9:22













just made one edit

– Peter Thomas
Nov 22 '18 at 9:51





just made one edit

– Peter Thomas
Nov 22 '18 at 9:51












1 Answer
1






active

oldest

votes


















1














Write a Java utility to modify the file linkedInOauth2RESTInput.json before you do the upload. You can use the file: prefix instead of classpath:, so I recommend you save the temp file into the target folder, then you can do this:



Given multipart file properties = { read: 'file:target/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }


But I agree that this is complicated, so I'm making a change to Karate so that you can instead of read, pass a value.



EDIT: this might also work depending on the server in this case:



* def tenantID = '2345';
* def json = read('classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json')
* multipart field properties = json





share|improve this answer


























  • Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

    – Anupama
    Nov 22 '18 at 10:42











  • @Anupama I have already made the fix. it will be available in 0.9.0

    – Peter Thomas
    Nov 22 '18 at 11:53











  • Waw great ! Thank you will test in new build :)

    – Anupama
    Nov 23 '18 at 10:31











  • Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

    – Anupama
    Nov 23 '18 at 13:24











  • @Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

    – Peter Thomas
    Nov 23 '18 at 13:54











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427252%2fhow-to-use-embedded-expressions-for-multipart-file-input-in-karate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Write a Java utility to modify the file linkedInOauth2RESTInput.json before you do the upload. You can use the file: prefix instead of classpath:, so I recommend you save the temp file into the target folder, then you can do this:



Given multipart file properties = { read: 'file:target/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }


But I agree that this is complicated, so I'm making a change to Karate so that you can instead of read, pass a value.



EDIT: this might also work depending on the server in this case:



* def tenantID = '2345';
* def json = read('classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json')
* multipart field properties = json





share|improve this answer


























  • Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

    – Anupama
    Nov 22 '18 at 10:42











  • @Anupama I have already made the fix. it will be available in 0.9.0

    – Peter Thomas
    Nov 22 '18 at 11:53











  • Waw great ! Thank you will test in new build :)

    – Anupama
    Nov 23 '18 at 10:31











  • Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

    – Anupama
    Nov 23 '18 at 13:24











  • @Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

    – Peter Thomas
    Nov 23 '18 at 13:54
















1














Write a Java utility to modify the file linkedInOauth2RESTInput.json before you do the upload. You can use the file: prefix instead of classpath:, so I recommend you save the temp file into the target folder, then you can do this:



Given multipart file properties = { read: 'file:target/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }


But I agree that this is complicated, so I'm making a change to Karate so that you can instead of read, pass a value.



EDIT: this might also work depending on the server in this case:



* def tenantID = '2345';
* def json = read('classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json')
* multipart field properties = json





share|improve this answer


























  • Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

    – Anupama
    Nov 22 '18 at 10:42











  • @Anupama I have already made the fix. it will be available in 0.9.0

    – Peter Thomas
    Nov 22 '18 at 11:53











  • Waw great ! Thank you will test in new build :)

    – Anupama
    Nov 23 '18 at 10:31











  • Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

    – Anupama
    Nov 23 '18 at 13:24











  • @Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

    – Peter Thomas
    Nov 23 '18 at 13:54














1












1








1







Write a Java utility to modify the file linkedInOauth2RESTInput.json before you do the upload. You can use the file: prefix instead of classpath:, so I recommend you save the temp file into the target folder, then you can do this:



Given multipart file properties = { read: 'file:target/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }


But I agree that this is complicated, so I'm making a change to Karate so that you can instead of read, pass a value.



EDIT: this might also work depending on the server in this case:



* def tenantID = '2345';
* def json = read('classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json')
* multipart field properties = json





share|improve this answer















Write a Java utility to modify the file linkedInOauth2RESTInput.json before you do the upload. You can use the file: prefix instead of classpath:, so I recommend you save the temp file into the target folder, then you can do this:



Given multipart file properties = { read: 'file:target/linkedInOauth2RESTInput.json', filename: 'blob', contentType: 'application/json' }


But I agree that this is complicated, so I'm making a change to Karate so that you can instead of read, pass a value.



EDIT: this might also work depending on the server in this case:



* def tenantID = '2345';
* def json = read('classpath:ic/feature/REST/TestData/linkedInOauth2RESTInput.json')
* multipart field properties = json






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 '18 at 9:51

























answered Nov 22 '18 at 9:41









Peter ThomasPeter Thomas

13.6k31844




13.6k31844













  • Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

    – Anupama
    Nov 22 '18 at 10:42











  • @Anupama I have already made the fix. it will be available in 0.9.0

    – Peter Thomas
    Nov 22 '18 at 11:53











  • Waw great ! Thank you will test in new build :)

    – Anupama
    Nov 23 '18 at 10:31











  • Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

    – Anupama
    Nov 23 '18 at 13:24











  • @Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

    – Peter Thomas
    Nov 23 '18 at 13:54



















  • Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

    – Anupama
    Nov 22 '18 at 10:42











  • @Anupama I have already made the fix. it will be available in 0.9.0

    – Peter Thomas
    Nov 22 '18 at 11:53











  • Waw great ! Thank you will test in new build :)

    – Anupama
    Nov 23 '18 at 10:31











  • Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

    – Anupama
    Nov 23 '18 at 13:24











  • @Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

    – Peter Thomas
    Nov 23 '18 at 13:54

















Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

– Anupama
Nov 22 '18 at 10:42





Hi Peter, I tried * multipart field properties = json this option. But its not working in our server. Only way is as u suggested i will try writing java utility for it. Its good if you provide this feature in future releases of Karate.

– Anupama
Nov 22 '18 at 10:42













@Anupama I have already made the fix. it will be available in 0.9.0

– Peter Thomas
Nov 22 '18 at 11:53





@Anupama I have already made the fix. it will be available in 0.9.0

– Peter Thomas
Nov 22 '18 at 11:53













Waw great ! Thank you will test in new build :)

– Anupama
Nov 23 '18 at 10:31





Waw great ! Thank you will test in new build :)

– Anupama
Nov 23 '18 at 10:31













Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

– Anupama
Nov 23 '18 at 13:24





Hi Peter, I tried in version 0.9.0.RC5. looks like its not stable as my existing js files are running infinite. After 0.9.0 release i will test.

– Anupama
Nov 23 '18 at 13:24













@Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

– Peter Thomas
Nov 23 '18 at 13:54





@Anupama if you want to ensure that you are able to use 0.9.0 final - PLEASE figure out a way to replicate this problem and file an issue immediately. no one else has reported anything like this.

– Peter Thomas
Nov 23 '18 at 13:54


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427252%2fhow-to-use-embedded-expressions-for-multipart-file-input-in-karate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ottavio Pratesi

Tricia Helfer

15 giugno