무한 Sending Request

장서연·2021년 7월 14일
0

/login 라우터를 구현한 뒤, 로그인 기능을 만들었다. 이를 테스트 하기 위해 포스트맨에서 json형식으로 POST 메소드를 사용하여 DB에 이미 등록되어있는 사용자의 계정정보로 로그인하여 응답을 받아오려했으나, 무한 Sending Request 이 계속 떴다. 이유는 다음과 같았다.

userSchema.methods.comparePassword = function(plainPassword, cb) {
  bcrypt.compare(plainPassword, this.password, function(err, isMatch) {
    if (err) return cb(err), cb(null, isMatch);
  });
};



위의 것을 아래처럼 고쳐야 한다. 원인은 단순 오타였는데, 이런 오타가 제일 잡기 힘들다


userSchema.methods.comparePassword = function(plainPassword, cb) {
  bcrypt.compare(plainPassword, this.password, function(err, isMatch) {
    if (err) return cb(err);
    cb(null, isMatch);
  });
};

, 를 ; 로 고쳤더니 바로 해결이 되었다. 오타에 주의하자 제발 ㅠㅠ

0개의 댓글