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

150
Visualizações
How to show value from response body when test fails

I'm new to writing pre-request script and tests in Postman. So, I wonder if there's possible to make show the value from response body when the tests fail.

This is the example of the error response body and I want the test result to "FAIL" and show the value from "errorReason" in the test results tab.

{
    "errors": [
        {
            "errorCode": 401,
            "errorReason": "BALANCE_BELOW_ZERO"
        }
    ]
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I using this way to get error message from api

async getSomething() {
    try {
      let response = await axios.get(
        `API/getSomething`
      );
      let data = response.data;
      htmlElememt.innerHTML = data 
      
    } catch (e) {
     // according to your error response 
      alert(e.response.errors.errorReason);
    }
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