added script to improve test page access and separate from release compilation. Formatting updates.

This commit is contained in:
Kevin G Christiano 2020-12-15 14:56:18 -05:00
parent 2eb5cc9254
commit 85401e583d

View File

@ -69,16 +69,16 @@
- (NSDictionary *) getHardCodedResponseForRequest:(MVMCoreRequestParameters *)request { - (NSDictionary *) getHardCodedResponseForRequest:(MVMCoreRequestParameters *)request {
NSDictionary *cannedResponse = nil; NSDictionary *cannedResponse = nil;
if(_jsonDictionary) { if (_jsonDictionary) {
BOOL matchesQuery = NO; BOOL matchesQuery = NO;
for(NSString *urlKey in _sortedKeys) { for (NSString *urlKey in _sortedKeys) {
NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithString:urlKey]; NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithString:urlKey];
if([urlComponents.path isEqualToString:request.pageType]) { if ([urlComponents.path isEqualToString:request.pageType]) {
matchesQuery = YES; matchesQuery = YES;
if(urlComponents.query) { if (urlComponents.query) {
for(NSURLQueryItem *item in urlComponents.queryItems) { for (NSURLQueryItem *item in urlComponents.queryItems) {
NSString *requestVal = [request.parameters stringForKey:item.name]; NSString *requestVal = [request.parameters stringForKey:item.name];
if(!requestVal || ![requestVal isEqualToString:item.value]) { if (!requestVal || ![requestVal isEqualToString:item.value]) {
matchesQuery = NO; matchesQuery = NO;
break; break;
} }
@ -88,7 +88,7 @@
cannedResponse = _jsonDictionary[urlKey]; cannedResponse = _jsonDictionary[urlKey];
// keep searching to see if there is a more exact match on parameters // keep searching to see if there is a more exact match on parameters
} }
if(matchesQuery) { if (matchesQuery) {
cannedResponse = _jsonDictionary[urlKey]; cannedResponse = _jsonDictionary[urlKey];
// found a request parameters match, accept as the best result and break out // found a request parameters match, accept as the best result and break out
break; break;
@ -101,7 +101,6 @@
cannedResponse = [self getHardCodedResponseForPageType:request.pageType]; cannedResponse = [self getHardCodedResponseForPageType:request.pageType];
} }
return cannedResponse; return cannedResponse;
} }