Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dariayermolova/450e83f03d15b5c8b34f922e386d8825 to your computer and use it in GitHub Desktop.
Save dariayermolova/450e83f03d15b5c8b34f922e386d8825 to your computer and use it in GitHub Desktop.
pm.sendRequest({
url: '{{your url}}',
method: 'POST',
header: {
'Content-Type': 'multipart/form-data',
},
body: {
mode: 'formdata',
formdata: [
{key: "{{your key}}", value: "{{your value}}", disabled: false, description: {content:"", type:"text/plain"}},
{key: "{{your key}}", value: "{{your value}}", disabled: false, description: {content:"", type:"text/plain"}},
{key: "{{your key}}", value: "{{your value}}", disabled: false, description: {content:"", type:"text/plain"}}
]
}
}, function(err, response) {
//сохраняем парметр set-cookie в переменную
var refresh = response.headers.get('set-cookie');
//обрезаем для получения куки
refresh = refresh.substr(2,36);
//сохраняем в переменную окружения
pm.environment.set("{{your value}}", refresh);
});
@iassainov
Copy link

Spasibo!

@TaylorShi
Copy link

tks u, this help me!

@david-woodside
Copy link

Danke viel mals! Ich wußte nicht ganz wie man die formdata aufbauen soll.

@yongchengzhao
Copy link

感谢分享~

@MahmoudElsawy057
Copy link

what if I want to upload a file with this same request ,
how can I do it ?

@csilva-intakedesk
Copy link

Amazing. Thank you so much.

@yannvr
Copy link

yannvr commented Feb 20, 2024

wicked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment