I am trying to send a POST request with an array of objects using axios. But I am having 500 internal server error and no exceptions on the server. When I send a single object it works fine but not with an array of objects, in this case, it not even trigger my REST service. Does someone have any idea? My array of objects looks like this:-
arrayofObjects:[
{},
{},
several objects here
]
POST request:-
axios.post(URL,JSON.stringify(this.arrayofObjects), headers)
.then(response=>{
returnData = (response.data);
})
.catch(ext=>{
alert(ext.response.data);
})
Here is the REST Service(not the complete code):-
@POST
@Path("/uvw")
@consumes(MediaType.APPLICATIOM_JSON)
public Response uVW(List<objectData> requested){
// remaining code
try{
return Response.ok().build();
}catch(){
return
}
}
来源:https://stackoverflow.com/questions/49323401/sending-post-axios-request-with-array-of-objects