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

257
Visualizações
Pre-Request Script scopes in Postman

I have collection named "Auth" with pre-request script where I define JavaScript variable "token", and some JavaScript general functions, which I want to use in my inner pre-request scripts.

Within "Auth" collection I have folder name "Tests" with own pre-request script. I expected both scripts to be merged but when I try to use "token" JavaScript variable from "Auth" collection I get an error:

ReferenceError: currentAccessToken is not defined

How to access JavaScript variables (and JavaScript functions) from collection pre-request script in inner folder pre-request script?

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

0

Postman has different variable scopes, which you would need to use, eg:

pm.globals.set("variable_key", "variable_value");
pm.globals.get("variable_key");

pm.collectionVariables.set("variable_key", "variable_value");
pm.collectionVariables.get("variable_key");

pm.environment.set("variable_key", "variable_value");
pm.environment.get("variable_key");

Please check out Using variables for more details.

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