0

I am using angular with spring boot, I want to post a string as the body of the post method in Angular using httpClient :

this.http.post<any>(url, myString);

in the API

@ApiOperation(value = "Saving prefs as string")
@PostMapping(value = "/customer/prefs")
public @ResponseBody ResponseEntity<<?> save(@RequestBody String prefs) {
    try {
        repository.save(userPrefs);
        return new ResponseEntity<>(new JsonMessage("SAVED"), HttpStatus.OK);
    } catch (Exception e) {
        return new ResponseEntity<>(new JsonError(e), HttpStatus.I_ERROR);
    }
}

but I am getting the prefs encoding not in utf-8, i dont know what i mess!.

a.oub-c
  • 41
  • 6

0 Answers0