Wrong postman response if not refreshing the webpage

Hello! Newbie here, learning web dev with an online course.
I am experiencing something odd with postman.

I am testing a very beginner script - testing if a user’s name and password match with my pseudo database (which is a simple js object).
My code is the absolute same as teacher.
My code works as expected only if i have refreshed the whole postman page. The teacher does not refresh anything each time and things work as expected.
I sometimes have to refresh the page several time and the code will work after some tries ^^.

I am using postman agent, updated, and testing on my localhost.
I am coding in vs code, my code is made ‘live’ using latest nodemon with npm start, latest LTS of node.
I tried through chrome, also tried in incognito mode, fearing addons like ublock.

I really don’t understand what is happening.
ideas?

Welcome to the community @yoanngodiet!

What happens when it fails? Are you getting an error code? Is Postman not sending the request?

Screenshots are always helpful.

thanks !
No error code, nothing happens. Looks like postman does not send anything.

I’d recommend opening the postman console (alt+ctrl+c) and seeing what is being sent when it doesn’t work.

By the look of your code, I’d expect it to only ever return a 400 or a 200 with the ‘Access Granted’ text. I don’t see how it could be anything else.

An alternative could be to use the postman app instead of doing it through the browser. Might be worth a shot.

Hahaha.
Works as it should with the desktop app :slight_smile:.
Thanks for the help Allen !

But it feels like this bug should be investigated…

1 Like