title: How to receive a string as a return from an API call in angular?
body: <p>I need to get response from my API call in form of string.
  My API function is simple (for testing)</p>
  
  <pre><code>
          [HttpPost("verifyCode")]
          public ContentResult verifyCode([FromBody] UserM resetModel)
          {
              return "This is response";
          }
  
  </code></pre>
  
  <p>API Call</p>
  
  <pre><code>verifyCode(username, code){
        const body = 'username=' + username + '&amp;code=' + code;
         let test = new UserM();
         test.username = username;
         test.code = code;
         const requestHeaders: HttpHeaders = new HttpHeaders({
          'Content-Type': 'application/json;charset=utf-8'
        });
        return this.http.post&lt;string&gt;('http://localhost:12763/api/account/verifyCode/', test, {headers: requestHeaders, withCredentials: true});
      }
  
  </code></pre>
  
  <p>i am trying to get the output here </p>
  
  <pre><code>
   this.userService.verifyCode(username,code).subscribe(
          (data)=&gt;{
            console.log(data);
          }
        )
  
  </code></pre>
  
  <p>But i dont get the output on console but get this error</p>
  
  <blockquote>
    <p>SyntaxError: Unexpected token R in JSON at position 0</p>
  </blockquote>