Add JSON payload to webmail "headers" action
This commit is contained in:
parent
7e11806bf9
commit
1c9da902d3
|
@ -759,19 +759,25 @@
|
||||||
- (id <WOActionResults>) getHeadersAction
|
- (id <WOActionResults>) getHeadersAction
|
||||||
{
|
{
|
||||||
NSArray *uids, *headers;
|
NSArray *uids, *headers;
|
||||||
|
NSDictionary *data;
|
||||||
WORequest *request;
|
WORequest *request;
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
|
|
||||||
request = [context request];
|
request = [context request];
|
||||||
if ([request formValueForKey: @"uids"] == nil)
|
data = [[request contentAsString] objectFromJSONString];
|
||||||
|
if (![[data objectForKey: @"uids"] isKindOfClass: [NSArray class]]
|
||||||
|
|| [[data objectForKey: @"uids"] count] == 0)
|
||||||
{
|
{
|
||||||
return [NSException exceptionWithHTTPStatus: 404
|
data = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
reason: @"No UID specified"];
|
@"No UID specified", @"error", nil];
|
||||||
|
return [self responseWithStatus: 404 /* Not Found */
|
||||||
|
andString: [data jsonRepresentation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
uids = [[request formValueForKey: @"uids"] componentsSeparatedByString: @","]; // Should we support ranges? ie "x-y"
|
uids = [data objectForKey: @"uids"];
|
||||||
headers = [self getHeadersForUIDs: uids
|
headers = [self getHeadersForUIDs: uids
|
||||||
inFolder: [self clientObject]];
|
inFolder: [self clientObject]];
|
||||||
|
|
||||||
response = [context response];
|
response = [context response];
|
||||||
[response setHeader: @"application/json; charset=utf-8"
|
[response setHeader: @"application/json; charset=utf-8"
|
||||||
forKey: @"content-type"];
|
forKey: @"content-type"];
|
||||||
|
|
Loading…
Reference in a new issue