Return the proper HTTP code when saving an event
parent
e59a4b4246
commit
d9b67a85f2
|
@ -446,6 +446,7 @@
|
|||
SOGoAppointmentObject *co;
|
||||
SoSecurityManager *sm;
|
||||
WORequest *request;
|
||||
unsigned int httpStatus;
|
||||
|
||||
event = [self event];
|
||||
co = [self clientObject];
|
||||
|
@ -515,16 +516,21 @@
|
|||
}
|
||||
|
||||
if (ex)
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"failure", @"status",
|
||||
[ex reason],
|
||||
@"message",
|
||||
nil];
|
||||
{
|
||||
httpStatus = 500;
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"failure", @"status",
|
||||
[ex reason], @"message",
|
||||
nil];
|
||||
}
|
||||
else
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"success", @"status", nil];
|
||||
{
|
||||
httpStatus = 200;
|
||||
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"success", @"status", nil];
|
||||
}
|
||||
|
||||
return [self responseWithStatus: 200
|
||||
return [self responseWithStatus: httpStatus
|
||||
andJSONRepresentation: jsonResponse];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue