Forked from dariayermolova/postman pre-request script (post form-data)
Created
May 13, 2021 10:55
-
-
Save vitaliiSmokov/20040877a294c728cc6756fbaa863c50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment