title: Expected one matching request, found 2 requests. How do I test for 2 requests
body: <p>I am working on an Angular application and I am using Jasmine to test the application.</p>
  
  <p>What I want is to test for two <strong>similar</strong> HTTP requests in one method such as, <code>ngOnInit()</code> .</p>
  
  <p>I have an HTTP request that is called twice in <code>ngOnInit()</code> method and
  write now the test case that I used throws an error like below:</p>
  
  <blockquote>
    <p>Error: Expected one matching request for criteria "Match URL: <a href="http://localhost:8080/api/demoList" rel="nofollow noreferrer">http://localhost:8080/api/demoList</a>", found 2 requests.</p>
  </blockquote>
  
  <p>For example,</p>
  
  <pre><code>// method to test
  
  ngOnInit() {
    this.httpGetRequest();
    // some other code
    this.httpGetRequest();
  }
  
  this.httpGetRequest() {
    this.httpClient.get(http://localhost:8080/api/getSomeList);
  }
  
  //test case for ngOnInit()
  
  it('should do something', () =&gt; {
    spyOn(component, 'ngOnInit').and.callThrough();
    component.ngOnInit();
  
    const req = httpTestingController.expectOne(`http://localhost:8080/api/getSomeList`);
    expect(req.request.method).toEqual('GET');
    req.flush(mockList);
  });
  </code></pre>
  
  <p>How can I test for more than one request of similar URL?</p>