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

146
Visualizações
Saving token is postman envvar automatically not working

API Response :

{
 "token" :"eyJ0eXAiOiJKV1QiLCfhfgJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImRiYWRtaW5AY2lkbnkub3JnIiwiZXhwIjoxNjMyNTY3OTY1LCJlbWFphbCI6ImRiYWRtaW5AY2gjglkbnkub3JnIiwib3JpZ19pYXQiOjE2MzI1NDk5NjV9.3ZtHRy0_jBao7hvQLSVcQuvIMIgjgjg7mmvKqlegS5Jo0-Q"
}

This is in Test

var res = pm.response.json();
pm.environment.set('env',token);

This is expected to save the token in env variable but the token did not work after saving.

What is the issue here?

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

0

Try this , it should work:

var res = pm.response.json();
pm.environment.set('env',res.token);

Basically the token you saved contained full response, not the token only.

about 4 years ago · Juan Pablo Isaza Relatório

0

var {token} = pm.response.json();
pm.environment.set('env',token);

You should access the property , you can access it by pm.response.json().token or by using destructure assignment

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