This is my params model:
data class ProductParams(
val name: String,
val key: String,
val parentProduct: Int?,
)
I send params:
{
"name": null,
"parentProduct": null,
"key": "TEST"
}
I get error code 500. How can I handle it?
Edit
Try setting name param to a String not null as its not an optional val.
Take a look at Http Status Codes in your case 500 refers to an Internal Server Error. A simple way to handle http status codes is to just check if the request was successful and not handle every single status code. :)