Return the proper HTTP code when saving an event

This commit is contained in:
Francis Lachapelle 2015-05-01 09:08:07 -04:00
parent e59a4b4246
commit d9b67a85f2

View file

@ -446,6 +446,7 @@
SOGoAppointmentObject *co; SOGoAppointmentObject *co;
SoSecurityManager *sm; SoSecurityManager *sm;
WORequest *request; WORequest *request;
unsigned int httpStatus;
event = [self event]; event = [self event];
co = [self clientObject]; co = [self clientObject];
@ -515,16 +516,21 @@
} }
if (ex) if (ex)
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys: {
@"failure", @"status", httpStatus = 500;
[ex reason], jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
@"message", @"failure", @"status",
nil]; [ex reason], @"message",
nil];
}
else 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]; andJSONRepresentation: jsonResponse];
} }