how to post string from angular 7 to asp.net web API core 2.1
from angular i am trying below code
getDecTokenDetails(token: string): Observable<string>
{
//return this.http.get<String>("/api/MicroApp/manju");
let headers = new HttpHeaders();
headers.set('Content-Type', 'application/json');
debugger;
return this.http.post<string>("/api/MicroApp", token, { headers: headers
});
}
IN webapi controller below code i am using
[HttpPost]
public IActionResult Post([FromBody] string value)
{
return Ok("toekn received " + value);
}
below error i am getting
HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request", url: "http://localhost:3974/api/MicroApp", ok: false, …}
Please help.