我正在尝试从内存数据库角度创建虚拟登录,而不使用任何 json 文件或内存服务的实时 api 我正在使用用户对象
const users = [
{ id: 1, userName: 'abhijeet', password: 'abh@123'},
];
使用 http 响应
const url = `${environment.apiEndPoint}users?userName=^${user.userName}$&password=^${user.password}$`;
this.http.get<UserDetails>(url).subscribe(resp => {
let user = resp;
错误是
{body: {…}, url: "/api/users?userName=^abhijeet$&password=^abh@123$", headers: HttpHeaders, status: 404, statusText: "Not Found"}
body:
error: "Collection 'undefined' not found"
__proto__: Object
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
status: 404
statusText: "Not Found"
url: "/api/users?userName=^abhijeet$&password=^abh@123$"
如果我从密码字段中删除 @ 并改用下划线,我会得到正确的响应,但 @ 不适用于任何归档。