title: Angular 6 HttpOptions, Observe Response, POST request
body: <p>I am trying to create a POST request to do a login with angular 6. I also wish to observe the full response. I do not know how to fit all the information into the request. This is my code so far:</p>
  
  <pre><code> loginRequest(userName: string, password: string, api: string = this.loginUrl): Observable&lt;object&gt; {
  
       const httpOptions = {
         headers: new HttpHeaders({
           'Content-Type': 'application/json'
          }),
           observe: 'response'
        };
        var body = {
          user: userName,
          password: password
        }
        return this.http.post(api, body, httpOptions)
     }
  </code></pre>
  
  <p>This actually appears to achieve what I want in my unit tests, but Visual Studio is showing an error in the third paramter of the post method. Would anyone be able to show me how to fit all this information into the request correctly?</p>
  
  <p>many thanks.</p>
  
  <p><strong>update</strong>
  I have just found this answer which describes the same solution but for some reason I am still getting the error <a href="https://stackoverflow.com/a/50989991/8896573">https://stackoverflow.com/a/50989991/8896573</a></p>
  
  <p><strong>solved</strong>
  <a href="https://stackoverflow.com/a/47761516/8896573">https://stackoverflow.com/a/47761516/8896573</a></p>