Post requests are fired twice


#1

Hello,

my backend call is fired twice when I call the post method.
What is wrong here?

 private post(url: string, body: any, options: RequestOptionsArgs) {
    const getRequest = () => this.http.post(url, body, options);

    // First try backend call
    const response = getRequest();
   
    const result = response
      .filter(res => res.status === 200 && !this.isSessionExpired(res))
      .map(res => res.json());

    //Session expired
    const sessionExpired = response
      .filter(res => (res.status === 200) && this.isSessionExpired(res))
      .mergeMap((res) => {
        let message = new MyMessage();
        message.text = 'Session expired';
        return Observable.throw(message);
      });

    return Observable
      .merge(
        result,
        sessionExpired  
      ).catch((err) => {
        if (!(err instanceof MyMessage)) {
          let message = new MyMessage();
          message.text = 'Other failure';
          return Observable.throw(message);
        }
        return Observable.throw(err);
      });
  }