summaryrefslogtreecommitdiff
path: root/test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h')
-rw-r--r--test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h52
1 files changed, 25 insertions, 27 deletions
diff --git a/test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h b/test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h
index a80abd1334..acab3a3b58 100644
--- a/test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h
+++ b/test/ios/OHHTTPStubs/OHHTTPStubs/Sources/OHHTTPStubsResponse.h
@@ -22,23 +22,21 @@
*
***********************************************************************************/
-// For SDK 7.1 Compatibility (as this macro was only included starting SDK 8.0)
-#ifndef NS_DESIGNATED_INITIALIZER
- #if __has_attribute(objc_designated_initializer)
- #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
- #else
- #define NS_DESIGNATED_INITIALIZER
- #endif
-#endif
////////////////////////////////////////////////////////////////////////////////
#pragma mark - Imports
#import <Foundation/Foundation.h>
+#import <OHHTTPStubs/Compatibility.h>
////////////////////////////////////////////////////////////////////////////////
#pragma mark - Defines & Constants
+// Non-standard download speeds
+extern const double
+OHHTTPStubsDownloadSpeed1KBPS, // 1.0 KB per second
+OHHTTPStubsDownloadSpeedSLOW; // 1.5 KB per second
+
// Standard download speeds.
extern const double
OHHTTPStubsDownloadSpeedGPRS,
@@ -47,13 +45,8 @@ OHHTTPStubsDownloadSpeed3G,
OHHTTPStubsDownloadSpeed3GPlus,
OHHTTPStubsDownloadSpeedWifi;
-#ifdef NS_ASSUME_NONNULL_BEGIN
- NS_ASSUME_NONNULL_BEGIN
- #define _nullable_ __nullable
-#else
- #define _nullable_
-#endif
+NS_ASSUME_NONNULL_BEGIN
////////////////////////////////////////////////////////////////////////////////
#pragma mark - Interface
@@ -70,7 +63,7 @@ OHHTTPStubsDownloadSpeedWifi;
/**
* The headers to use for the fake response
*/
-@property(nonatomic, strong) NSDictionary* _nullable_ httpHeaders;
+@property(nonatomic, strong, nullable) NSDictionary* httpHeaders;
/**
* The HTTP status code to use for the fake response
*/
@@ -79,7 +72,7 @@ OHHTTPStubsDownloadSpeedWifi;
* The inputStream used when sending the response.
* @note You generally don't manipulate this directly.
*/
-@property(nonatomic, strong) NSInputStream* _nullable_ inputStream;
+@property(nonatomic, strong, nullable) NSInputStream* inputStream;
/**
* The size of the fake response body, in bytes.
*/
@@ -101,9 +94,7 @@ OHHTTPStubsDownloadSpeedWifi;
*
* If `error` is non-`nil`, the request will result in a failure and no response will be sent.
*/
-@property(nonatomic, strong) NSError* _nullable_ error;
-
-
+@property(nonatomic, strong, nullable) NSError* error;
////////////////////////////////////////////////////////////////////////////////
@@ -125,7 +116,7 @@ OHHTTPStubsDownloadSpeedWifi;
*/
+(instancetype)responseWithData:(NSData*)data
statusCode:(int)statusCode
- headers:(NSDictionary* _nullable_)httpHeaders;
+ headers:(nullable NSDictionary*)httpHeaders;
/* -------------------------------------------------------------------------- */
@@ -145,7 +136,7 @@ OHHTTPStubsDownloadSpeedWifi;
*/
+(instancetype)responseWithFileAtPath:(NSString *)filePath
statusCode:(int)statusCode
- headers:(NSDictionary* _nullable_)httpHeaders;
+ headers:(nullable NSDictionary*)httpHeaders;
/* -------------------------------------------------------------------------- */
#pragma mark > Building an error response
@@ -205,6 +196,15 @@ OHHTTPStubsDownloadSpeedWifi;
/*! @name Initializers */
/**
+ * Designated empty initializer
+ *
+ * @return An empty `OHHTTPStubsResponse` on which you need to set either an error or a statusCode, httpHeaders, inputStream and dataSize.
+ *
+ * @note This is not recommended to use this method directly. You should use `initWithInputStream:dataSize:statusCode:headers:` instead.
+ */
+-(instancetype)init NS_DESIGNATED_INITIALIZER;
+
+/**
* Designed initializer. Initialize a response with the given input stream, dataSize,
* statusCode and headers.
*
@@ -220,7 +220,7 @@ OHHTTPStubsDownloadSpeedWifi;
-(instancetype)initWithInputStream:(NSInputStream*)inputStream
dataSize:(unsigned long long)dataSize
statusCode:(int)statusCode
- headers:(NSDictionary* _nullable_)httpHeaders NS_DESIGNATED_INITIALIZER;
+ headers:(nullable NSDictionary*)httpHeaders NS_DESIGNATED_INITIALIZER;
/**
@@ -236,7 +236,7 @@ OHHTTPStubsDownloadSpeedWifi;
*/
-(instancetype)initWithFileAtPath:(NSString*)filePath
statusCode:(int)statusCode
- headers:(NSDictionary* _nullable_)httpHeaders;
+ headers:(nullable NSDictionary*)httpHeaders;
/**
@@ -250,7 +250,7 @@ OHHTTPStubsDownloadSpeedWifi;
*/
-(instancetype)initWithData:(NSData*)data
statusCode:(int)statusCode
- headers:(NSDictionary* _nullable_)httpHeaders;
+ headers:(nullable NSDictionary*)httpHeaders;
/**
@@ -266,6 +266,4 @@ OHHTTPStubsDownloadSpeedWifi;
@end
-#ifdef NS_ASSUME_NONNULL_END
- NS_ASSUME_NONNULL_END
-#endif
+NS_ASSUME_NONNULL_END