Currently, I have an endpoint set up to accept a Set<> as a @RequestBody in the following manner:
public @ResponseBody ResponseEntity<Response> addTeamOwner(@RequestParam("teamName") String teamName, @RequestBody Set<String> emails, HttpServletRequest request){...}
On the Angular frontend side, the endpoint is being called like this:
let params = new HttpParams().set('teamName', teamName);
let url = `${UrlManager.TEAMS}/addOwners?${params.toString()}`;
this.httpClient.post<any>(url, emails);
The issue arises where a 400 Bad Request error is returned:
HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: 'Bad Request', url: 'http://localhost:4200/api/teams/addOwners?teamName=DEMO_TEAM', ok: false, ...}
It seems that the backend is not able to accept the Set that Angular is sending. Interestingly, changing it to an Array resolves the issue.
Just for your information, my API is built on SpringBoot and the frontend is developed in Angular.