title: How to communicate with Angular Http and ip address
body: <p>I have an android device and I'm trying to make a web app that will communicate with it (send json etc.).</p>
  <p>I have made an api service that will send either a post or HttpRequest but I got stuck because I'm getting errors like bad request and connection failed.
  Both my notebook and the android are connected to the same wifi wirelessly and the android device is connected on a static ip address.</p>
  <p>Here is my api service:</p>
  <pre><code>public post&lt;T&gt;(endpoint: string, params = null, headers?): Observable&lt;T&gt; {
      return this.http.post&lt;T&gt;('http://' + endpoint, params, headers ? headers : {headers: this.getRequestHeaders()})
        .pipe(httpRetry(), tap(null, err =&gt; this.interceptError(err)));
    }
  
  public request&lt;T&gt;(method, endpoint: string, data, headers?: HttpHeaders) {
      return this.http.request&lt;T&gt;(method, endpoint, {
        body: data,
        headers: headers
      });
    }
  </code></pre>
  <p>And here is my component using those functions:</p>
  <pre><code>sendRequest() {
      this.apiService.request('string', this.basic.controls.ENDPOINT.value, this.selectedFile, this.getHeaders(true))
        .subscribe((response: HttpResponse&lt;any&gt;) =&gt; this.response = response);
    }
  
    sendPost() {
      this.apiService.post(this.basic.controls.ENDPOINT.value, this.selectedFile, this.getHeaders(true))
        .subscribe((response: HttpResponse&lt;any&gt;) =&gt; this.response = response);
    }
  
   getHeaders( isMultipart: boolean = false,
                acceptableMimeType: string = ApiService.DEFAULT_ACCEPTABLE_MIME_TYPE,
                anonymous: boolean = false): HttpHeaders {
      const Authorization = btoa(this.basic.controls.PASSWORD.value + this.basic.controls.USERNAME.value);
  
      const headers = {
        'X-Host-Override': '192.168.0.42',
        'Content-Type': 'application/json',
        'Content-Length': '120', // TODO add logic for correct content length
        'Authorization': Authorization
      };
  
      if (!isMultipart) {
        headers['Content-Type'] = 'application/json';
      }
      return new HttpHeaders(headers);
    }
  </code></pre>
  <p>The endpoint is set to 192.168.0.42 and the port to 8080 (I also have no idea what port number to use).
  Also they are sending a json file thus the this.selected file.</p>