Hunter Kelly
03/03/2021, 2:07 PM@Post("/createItems")
fun createItems(info: ItemInfo): HttpResponse {
ItemStorage.createItems(info)
return HttpResponse(201, MimeType.JSON, "")
}
data class ItemInfo(
val name: String,
val count: Int,
val details: String,
)
But when I make the following call, I get an error that the parameter is missing:
POST /1/createItems HTTP/1.1
Accept: application/json, */*;q=0.5
{
"info": {
"count": 10,
"details": "test1 details",
"name": "test1"
}
}
Response is:
HTTP/1.1 500 Internal Server Error
Connection: keep-alive
Content-Length: 35
Content-Type: text/plain
Date: Wed, 03 Mar 2021 13:56:42 GMT
Required argument 'info' is missing
Hunter Kelly
03/03/2021, 2:08 PMTanVD
03/04/2021, 8:15 AMTanVD
03/04/2021, 8:16 AMChristian Schwoerer
03/04/2021, 4:22 PMChristian Schwoerer
03/04/2021, 4:22 PM