我使用 Angular 2 MockBackend 来模拟结果并设置响应取决于方法类型(Post|Get|...)。例如:
if (connection.request.url.endsWith('/api/authenticate') && connection.request.method === RequestMethod.Post) {
但是我在编译时有错误。例如:
[default] ...
Operator '===' cannot be applied to types 'RequestMethod.Post' and 'RequestMethod.Get'.