-
Notifications
You must be signed in to change notification settings - Fork 277
How to return 404, 403 or any error code to renderer process ? #219
Comments
@redplane this is a rather simple but somewhat complicated decision when you are trying to go with an approach. The question here is what should the default value be - OK (200) or some error code since most developers do not set this anyway? So what we have had from the beginning is to ignore that even if set by developer. So for simple processing it is either OK (200) or BadRequest (400).
But I think it is high time we changed that. This will be revisited. The way this has worked for other developers is to wrap the payload response itself as the Data. private static ChromelyResponse Connect(ChromelyRequest request)
{
var content = new SomeClass() {
Status = 404,
StatusText = "Not Found",
Data = "No Data"
}
return new ChromelyResponse(request.Id)
{
Data = content
}
} Thanks. |
For now, I'm using your above workaround. |
Imo, this issue shouldnt be closed, because http status code is necessary for front end to handle exceptions |
@redplane please read my comment closely.
You said the workaround works, right? The change is simple, but one needs to spend time to see what else will be impacted, so let us spend sometime to make that improvement. If you want to leave it opened until it is resolved, you can go ahead and do that. Very soon I will create a master list of what will be included in next release. This will be part of it. You can check back to see when. But no promises on timeline. Thanks. |
Hi,
I'm using chromely for my desktop app development.
Till now, everything seems to be OK.
However, when I try to return HttpStatusCode which is about Http errors, such as: 401, 403, 404, every time ajax is done, the response is always 200.
FYI, this is what I'm doing:
Any tutorial about this please ?
The text was updated successfully, but these errors were encountered: