This commit is contained in:
Pierre-Olivier Latour
2014-04-20 10:34:45 -03:00
parent 519866bc03
commit 143ca5b99f
3 changed files with 19 additions and 18 deletions
@@ -78,7 +78,7 @@
/** /**
* Initializes a data response from text encoded using UTF-8. * Initializes a data response from text encoded using UTF-8.
*/ */
- (instancetype)initWithText:(NSString*)text; // Encodes using UTF-8 - (instancetype)initWithText:(NSString*)text;
/** /**
* Initializes a data response from HTML encoded using UTF-8. * Initializes a data response from HTML encoded using UTF-8.
@@ -87,6 +87,7 @@
/** /**
* Initializes a data response from an HTML template encoded using UTF-8. * Initializes a data response from an HTML template encoded using UTF-8.
*
* All occurences of "%variable%" within the HTML template are replaced with * All occurences of "%variable%" within the HTML template are replaced with
* their corresponding values. * their corresponding values.
*/ */
@@ -46,13 +46,13 @@
/** /**
* Creates a client error response with the corresponding HTTP status code * Creates a client error response with the corresponding HTTP status code
* and an optional underlying NSError. * and an underlying NSError.
*/ */
+ (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
/** /**
* Creates a server error response with the corresponding HTTP status code * Creates a server error response with the corresponding HTTP status code
* and an optional underlying NSError. * and an underlying NSError.
*/ */
+ (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
@@ -68,13 +68,13 @@
/** /**
* Initializes a client error response with the corresponding HTTP status code * Initializes a client error response with the corresponding HTTP status code
* and an optional underlying NSError. * and an underlying NSError.
*/ */
- (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
/** /**
* Initializes a server error response with the corresponding HTTP status code * Initializes a server error response with the corresponding HTTP status code
* and an optional underlying NSError. * and an underlying NSError.
*/ */
- (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
@@ -31,20 +31,20 @@
* The GCDWebServerFileResponse subclass of GCDWebServerResponse reads the body * The GCDWebServerFileResponse subclass of GCDWebServerResponse reads the body
* of the HTTP response from a file on disk. * of the HTTP response from a file on disk.
* *
* It will automatically set the lastModifiedDate and eTag properties of the * It will automatically set the contentType, lastModifiedDate and eTag
* GCDWebServerResponse according to the file metadata. * properties of the GCDWebServerResponse according to the file extension and
* metadata.
*/ */
@interface GCDWebServerFileResponse : GCDWebServerResponse @interface GCDWebServerFileResponse : GCDWebServerResponse
/** /**
* Creates a response with the contents of a file and the content type * Creates a response with the contents of a file.
* automatically set from the file extension.
*/ */
+ (instancetype)responseWithFile:(NSString*)path; + (instancetype)responseWithFile:(NSString*)path;
/** /**
* Creates a response like +responseWithFile: but sets the "Content-Disposition" * Creates a response like +responseWithFile: and sets the "Content-Disposition"
* HTTP header appropriately for a download if the "attachment" argument is YES. * HTTP header for a download if the "attachment" argument is YES.
*/ */
+ (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment; + (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment;
@@ -57,21 +57,21 @@
+ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range; + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range;
/** /**
* Creates a response like +responseWithFile:byteRange: but also sets the * Creates a response like +responseWithFile:byteRange: and sets the
* "Content-Disposition" HTTP header appropriately for a download if the * "Content-Disposition" HTTP header for a download if the "attachment"
* "attachment" argument is YES. * argument is YES.
*/ */
+ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment; + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment;
/** /**
* Initializes a response with the contents of a file and the content type * Initializes a response with the contents of a file.
* automatically set from the file extension.
*/ */
- (instancetype)initWithFile:(NSString*)path; - (instancetype)initWithFile:(NSString*)path;
/** /**
* Initializes a response like -initWithFile: but sets the "Content-Disposition" * Initializes a response like +responseWithFile: and sets the
* HTTP header appropriately for a download if the "attachment" argument is YES. * "Content-Disposition" HTTP header for a download if the "attachment"
* argument is YES.
*/ */
- (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment; - (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment;