My curl request like below.
$ curl -ki -X POST -H "Content-Type:application/json;charset=utf-8" localhost:8081/Customers-Spring-MVC-Hibernate/customer -d '{"name": "anil","age": 1,"phoneNumber": 77955,"email": "[email protected]","password": "Password"}'
where i have given the content-type:application/json but i hit 415 status code. Here is the response i got and i could see that Content-Type:text/html is being set is it proper here..?
Content-Type: text/html;charset=utf-8 Content-Language: en Content-Length: 1097 Date: Wed, 16 Nov 2016 05:29:27 GMT
Here is my controller definition:
@RequestMapping(method = RequestMethod.POST)
public void addCustomer(
@RequestBody final CustomerV1 customerDto) throws Exception
{
Please let me know if any workarounds.. i have tried removing and adding the charset-utf-8 but no use i still hit 415.
Adding my DTO definition if any problems here.. JSON DTO:
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeName("customer")
public class CustomerV1 {
private String name;`enter code here`
private int age;
private long phoneNumber;
private String email;
private String password;