Return the proper HTTP code when saving an event

pull/91/head
Francis Lachapelle 2015-05-01 09:08:07 -04:00
parent e59a4b4246
commit d9b67a85f2
1 changed files with 14 additions and 8 deletions

View File

@ -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];
}