
Koa使用md5.update(password)傳參數(shù)出錯(cuò),如何解決?
在使用Koa框架時(shí),你可能會(huì)遇到使用md5.update(password)傳參報(bào)錯(cuò)的問(wèn)題。
問(wèn)題表現(xiàn)為postman請(qǐng)求返回internal Server Error,但將update中的password參數(shù)改為常量后,問(wèn)題消失。
解決方案:
- 確保數(shù)據(jù)庫(kù)中對(duì)應(yīng)的密碼字段varchar類型大小足夠,如varchar(20)改成varchar(50)。
- 將md5.update(password)改為md5.update(password.toString()),即使在其他代碼示例中未提及toString。