Question · Angular course · Module 11: Testing

Role of req.flush()

What does the req.flush(mockData) method do in an HTTP test?

Answer options

  • Cancels the intercepted HTTP request
  • Simulates the server response, returning mockData to the subscriber
  • Clears the browser cache
  • Sends a real request to the server

You can check the correct answer by solving this task in the CodeWorlds game.