I'm working on a simple tutorial project using Angular 6 and ASP.NET Core WebAPI.
I'm not quite sure what i'm missing, but my POST calls don't work. To be precise, everything works in terms of communication with the web service, but the object that is passed into my controller method parameter has all its properties set to null or default value when null isn't admitted by C# types.
Here's my call in typescript:
createRequest(request: PrintRequestDto): Observable<PrintRequestDto> {
const actionUrl = this.apiBaseUrl + 'CreateRequest';
return this.http.post<PrintRequestDto>(actionUrl, JSON.stringify(request)); }
And this is my server-side C# method:
[Authorize]
[HttpPost]
[Route("CreateRequest")]
public PrintRequestDto CreateRequest(PrintRequestDto request)
{
return _printServiceManager.CreateRequest(request);
}
I already found this question here SO Question, but adding content-type specifications in my headers is not helping. Just to let you know, I'm using the HttpInterceptor built-in into Angular to inject JWT & content type informations in all my requests' headers.
As you can see here, they look properly set:
I would also like to better understand the http features when it comes to these things, so if you have a link to some complete documentation to provide, it would be awesome.