Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to send files from newman #387

Open
proDOOMman opened this issue Jul 26, 2022 · 4 comments
Open

Add ability to send files from newman #387

proDOOMman opened this issue Jul 26, 2022 · 4 comments
Labels
question Further information is requested

Comments

@proDOOMman
Copy link

If openApi schema has "binary" content ("schema": {"type": "string","format": "binary"}), it will be translated into postman collection with body:

"body": {
"mode": "file"
},

To send this file from newman, I should change collection to:

"body": {
"mode": "file", "file": {"src": "files/MyFile.bin"}
},

But I can't find any way to do this. "Globals -> portmanReplacement" can't help me with such replacement.

@thim81 thim81 added the question Further information is requested label Aug 11, 2022
@thim81
Copy link
Collaborator

thim81 commented Aug 11, 2022

@proDOOMman, Question: Do you want to overwrite the "file" elements, with a custom "file": {"src": "files/MyFile.bin"} OR do you expect this to be part of the conversion?

@thim81
Copy link
Collaborator

thim81 commented Nov 6, 2022

@proDOOMman Any feedback from you, that we can look into?

@wernermorgenstern
Copy link

@thim81 , I need this functionality too. Can I just specify a specific file? Or make it part of the conversion?

@Lars-Brebels-92
Copy link

For anyone that still needs this. I did the following:
In the newman script:

globals:{
  "values": [
    {
        "key": "filePathSystem",
        "value": `${process.cwd().toString()}`,
        "type": "text",
        "enabled": true
    }
  ]
  }

Then in the prequest script:

filePathSystem = pm.globals.get('filePathSystem');
pm.request.body = {
    mode: "file",
    file: filePathSystem+"/PathFromRunFolderToFile/File.json"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants