0

here i am writing a test script after getting user details from get request if the user exist i am trying to delete it i already have a delete request named "deleteUser" with url:http://localhost:8000/delete/user but pm.sendRequest("delete user") is treating as http://deleteUser instead of http://localhost:8000/delete/user here is my script for get user request

pm.test('api workflows',()=>{
    let data=pm.response.json();
    if(data.user){
        pm.sendRequest('deleteUser')
    }
 pm.sendRequest('http://localhost:8000/delete/user');

works perfectly fine but i want to access by req name i have defined can it be done like the deprecated version postman.sendNextRequest('request name'); or do i have to set env varaible with respective url to call next request by request name

  • Those 2 commands are not the same. `.sendRequest()` allows you to send an async request from the sandbox. `.setNextRequest('request name string')` is for controlling the sequence when run with the Collection Runner. https://learning.postman.com/docs/running-collections/building-workflows/ – Danny Dainton Dec 24 '22 at 23:18

0 Answers0