I have an angular client that is sending an HttpRequest to server to get client informations:
getClient(roleId): Observable<ClientDto> {
let params = new HttpParams();
params = params.append('Id', clientId);
return this._httpClient.get<ClientDto>('myurl', {params});
}
and on the controller I have
[HttpGet]
public async Task<ActionResult<ClientDto>> GetClient(EntityDto<int> data)
{
return Ok(await clientsService.GetClient(data.Id));
}
public class EntityDto : EntityDto<int>, IEntityDto
{
public EntityDto()
{
}
public EntityDto(int id)
: base(id)
{
}
}
public class EntityDto<TKey> : IEntityDto<TKey>
{
[Required]
public TKey Id { get; set; }
public EntityDto()
{
}
public EntityDto(TKey id)
{
Id = id;
}
}
public interface IEntityDto : IEntityDto<int>
{
}
public interface IEntityDto<TKey>
{
/// <summary>
/// Id of the entity.
/// </summary>
TKey Id { get; set; }
}
When I make the call from angular I receive an Http status 415 response Does any one knows why this happers?