Custom response code
How can I use a custom response code that's not set in default crow, like 1001? now 500 will be responsed for all other custom codes.
Thank you!
Currently, Crow doesn't support custom status codes. if it is to be implemented, it should not be by simply using crow::response(1001).
I ran into a similar issue while integrating with another library. The library's return codes had overlap with standard status codes. In this case, I standardized my response body to include the required information. Here's an example of the response body:
{
"code": 200,
"type": "invalid module number",
"message": "module slot not found"
}
I don't know much about your specific implementation; so your mileage may vary.
You can use your own http response codes as described above. Including the code and additional error responses into the response body is not supported by the library as it is not part of http standard.