Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
Postman - conditionally running a request

When using Postman's Collection Runner and reading a csv file - I have two requests: A Get, and a Put. These requests are in their own folder and it's that folder that I'm kicking off Collection Runner from.

The response from the Get simply returns either true or false.

The Put Request flips this to false and that's it. So I thought it'd be easy enough:

var jsonInfo = pm.response.json();
console.log(data["AppId"] + " = " + jsonInfo);
if (jsonInfo === true)
{
    console.log("Setting " + data["AppId"] + " to false.");
    postman.setNextRequest("Change-AppID-Decision-to-False");    
}

Because I don't want the Put to run all the time, when using Collection Runner I have the Put unchecked. The Get kicks off, and I know it gets into the body of the if statement as it writes the statement to the console but the Put never runs after the Get request.

I'll concede that I could just run the Put since all the appId's that run through here need to be set to false but for my own knowledge I'm wondering if this is possible because it feels like it should be a simple and useful thing that Postman should be able to do :). Thoughts?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Because I don't want the Put to run all the time, when using Collection Runner I have the Put unchecked.

That does not work, as only checked Requests are considered by Postman Run.

But the fix should be as easy at to terminate the run:

postman.setNextRequest(null)

So your code should look like:

var jsonInfo = pm.response.json();
console.log(data["AppId"] + " = " + jsonInfo);
if (jsonInfo === true)
{
    console.log("Setting " + data["AppId"] + " to false.");
    postman.setNextRequest("Change-AppID-Decision-to-False");    
} else {
    console.log("Nothing to do now");
    postman.setNextRequest(null)
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda