Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add timeoutInterval property to RKClient so that it can be passed on …

…to RKRequest.
  • Loading branch information...
commit 8946f4d7022b9346b46e65b7d5d9d3d7b3db7a5b 1 parent dab403a
@bmorton bmorton authored blakewatters committed
Showing with 14 additions and 0 deletions.
  1. +7 −0 Code/Network/RKClient.h
  2. +7 −0 Code/Network/RKClient.m
View
7 Code/Network/RKClient.h
@@ -200,6 +200,13 @@ NSString *RKPathAppendQueryParams(NSString *resourcePath, NSDictionary *queryPar
@property (nonatomic, readonly) NSMutableDictionary *HTTPHeaders;
/**
+ * An optional timeout interval within which the request should be cancelled.
+ * This is passed along to RKRequest if set. If it isn't set, it will default
+ * to RKRequest's default timeoutInterval.
+ */
+@property (nonatomic, assign) NSTimeInterval timeoutInterval;
+
+/**
Accept all SSL certificates. This is a potential security exposure,
and should be used ONLY while debugging in a controlled environment.
View
7 Code/Network/RKClient.m
@@ -90,6 +90,7 @@ @implementation RKClient
@synthesize requestCache = _requestCache;
@synthesize cachePolicy = _cachePolicy;
@synthesize requestQueue = _requestQueue;
+@synthesize timeoutInterval = _timeoutInterval;
+ (RKClient *)sharedClient {
return sharedClient;
@@ -222,6 +223,12 @@ - (void)setupRequest:(RKRequest *)request {
request.queue = self.requestQueue;
request.reachabilityObserver = self.reachabilityObserver;
+ // If a timeoutInterval was set on the client, we'll pass it on to the request.
+ // Otherwise, we'll let the request default to its own timeout interval.
+ if (self.timeoutInterval) {
+ request.timeoutInterval = self.timeoutInterval;
+ }
+
// OAuth 1 Parameters
request.OAuth1AccessToken = self.OAuth1AccessToken;
request.OAuth1AccessTokenSecret = self.OAuth1AccessTokenSecret;
Please sign in to comment.
Something went wrong with that request. Please try again.