Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Throw error message in pre request script is not working
pm.sendRequest(options, function (err, res) {
    if (res.code == 400) {
        throw new Error("Invalid");
    }else{
        pm.request.headers.add({
        key: "Authorization",
        value: 'Bearer '+res.json().access_token});
    }
});

Above Pre Request Script is throwing Error

Response: There was an error in evaluating the Pre-request Script:Error: Invalid

Postman Version: 9.7.1, OS: Windows, App Type: Postman Desktop Application

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

it does what it was asked , it throws the error “invalid” as the status was 400 .

so you get the mentioned error. saying “invalid” . Try changing the error message

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!