RKResponse Class Reference
Inherits from | NSObject |
Declared in | RKResponse.h RKResponse.m |
Tasks
-
request
The request that generated this response
property -
URL
The URL the response was loaded from
property -
MIMEType
The MIME Type of the response body
property -
statusCode
The status code of the HTTP response
property -
allHeaderFields
Return a dictionary of headers sent with the HTTP response
property -
body
The data returned as the response body
property -
failureError
The error returned if the URL connection fails
property -
cookies
An NSArray of NSHTTPCookie objects associated with the response
property -
– initWithRequest:
Initialize a new response object for a REST request
-
– initWithSynchronousRequest:URLResponse:body:error:
Initializes a response object from the results of a synchronous request
-
– localizedStatusCodeString
Return the localized human readable representation of the HTTP Status Code returned
-
– bodyAsString
Return the response body as an NSString
-
– bodyAsJSON
Return the response body parsed as JSON into an object
-
– failureErrorDescription
Will determine if there is an error object and use it’s localized message
-
– isFailure
Indicates that the connection failed to reach the remote server. The details of the failure are available on the failureError reader.
-
– isInvalid
Indicates an invalid HTTP response code less than 100 or greater than 600
-
– isInformational
Indicates an HTTP response code between 100 and 199
-
– isSuccessful
Indicates an HTTP response code between 200 and 299
-
– isRedirection
Indicates an HTTP response code between 300 and 399
-
– isClientError
Indicates an HTTP response code between 400 and 499
-
– isServerError
Indicates an HTTP response code between 500 and 599
-
– isError
Indicates that the response is either a server or a client error
-
– isOK
Indicates an HTTP response code of 200
-
– isCreated
Indicates an HTTP response code of 201
-
– isUnauthorized
Indicates an HTTP response code of 401
-
– isForbidden
Indicates an HTTP response code of 403
-
– isNotFound
Indicates an HTTP response code of 404
-
– isUnprocessableEntity
Indicates an HTTP response code of 422
-
– isRedirect
Indicates an HTTP response code of 301, 302, 303 or 307
-
– isEmpty
Indicates an empty HTTP response code of 201, 204, or 304
-
– isServiceUnavailable
Indicates an HTTP response code of 503
-
– contentType
Returns the value of ‘Content-Type’ HTTP header
-
– contentLength
Returns the value of the ‘Content-Length’ HTTP header
-
– location
Returns the value of the ‘Location’ HTTP Header
-
– isHTML
True when the server turned an HTML response (MIME type is text/html)
-
– isXHTML
True when the server turned an XHTML response (MIME type is application/xhtml+xml)
-
– isXML
True when the server turned an XML response (MIME type is application/xml)
-
– isJSON
True when the server turned an XML response (MIME type is application/json)
Properties
MIMEType
The MIME Type of the response body
@property (nonatomic, readonly) NSString *MIMEType
Declared In
RKResponse.h
URL
The URL the response was loaded from
@property (nonatomic, readonly) NSURL *URL
Declared In
RKResponse.h
allHeaderFields
Return a dictionary of headers sent with the HTTP response
@property (nonatomic, readonly) NSDictionary *allHeaderFields
Declared In
RKResponse.h
body
The data returned as the response body
@property (nonatomic, readonly) NSData *body
Declared In
RKResponse.h
cookies
An NSArray of NSHTTPCookie objects associated with the response
@property (nonatomic, readonly) NSArray *cookies
Declared In
RKResponse.h
failureError
The error returned if the URL connection fails
@property (nonatomic, readonly) NSError *failureError
Declared In
RKResponse.h
request
The request that generated this response
@property (nonatomic, readonly) RKRequest *request
Declared In
RKResponse.h
Instance Methods
bodyAsJSON
Return the response body parsed as JSON into an object
- (id)bodyAsJSON
Declared In
RKResponse.h
bodyAsString
Return the response body as an NSString
- (NSString *)bodyAsString
Declared In
RKResponse.h
contentLength
Returns the value of the ‘Content-Length’ HTTP header
- (NSString *)contentLength
Declared In
RKResponse.h
contentType
Returns the value of ‘Content-Type’ HTTP header
- (NSString *)contentType
Declared In
RKResponse.h
failureErrorDescription
Will determine if there is an error object and use it’s localized message
- (NSString *)failureErrorDescription
Declared In
RKResponse.h
initWithRequest:
Initialize a new response object for a REST request
- (id)initWithRequest:(RKRequest *)request
Declared In
RKResponse.h
initWithSynchronousRequest:URLResponse:body:error:
Initializes a response object from the results of a synchronous request
- (id)initWithSynchronousRequest:(RKRequest *)request URLResponse:(NSURLResponse *)URLResponse body:(NSData *)body error:(NSError *)error
Declared In
RKResponse.h
isClientError
Indicates an HTTP response code between 400 and 499
- (BOOL)isClientError
Declared In
RKResponse.h
isEmpty
Indicates an empty HTTP response code of 201, 204, or 304
- (BOOL)isEmpty
Declared In
RKResponse.h
isError
Indicates that the response is either a server or a client error
- (BOOL)isError
Declared In
RKResponse.h
isFailure
Indicates that the connection failed to reach the remote server. The details of the failure are available on the failureError reader.
- (BOOL)isFailure
Declared In
RKResponse.h
isHTML
True when the server turned an HTML response (MIME type is text/html)
- (BOOL)isHTML
Declared In
RKResponse.h
isInformational
Indicates an HTTP response code between 100 and 199
- (BOOL)isInformational
Declared In
RKResponse.h
isInvalid
Indicates an invalid HTTP response code less than 100 or greater than 600
- (BOOL)isInvalid
Declared In
RKResponse.h
isJSON
True when the server turned an XML response (MIME type is application/json)
- (BOOL)isJSON
Declared In
RKResponse.h
isRedirect
Indicates an HTTP response code of 301, 302, 303 or 307
- (BOOL)isRedirect
Declared In
RKResponse.h
isRedirection
Indicates an HTTP response code between 300 and 399
- (BOOL)isRedirection
Declared In
RKResponse.h
isServerError
Indicates an HTTP response code between 500 and 599
- (BOOL)isServerError
Declared In
RKResponse.h
isServiceUnavailable
Indicates an HTTP response code of 503
- (BOOL)isServiceUnavailable
Declared In
RKResponse.h
isSuccessful
Indicates an HTTP response code between 200 and 299
- (BOOL)isSuccessful
Declared In
RKResponse.h
isUnauthorized
Indicates an HTTP response code of 401
- (BOOL)isUnauthorized
Declared In
RKResponse.h
isUnprocessableEntity
Indicates an HTTP response code of 422
- (BOOL)isUnprocessableEntity
Declared In
RKResponse.h
isXHTML
True when the server turned an XHTML response (MIME type is application/xhtml+xml)
- (BOOL)isXHTML
Declared In
RKResponse.h
isXML
True when the server turned an XML response (MIME type is application/xml)
- (BOOL)isXML
Declared In
RKResponse.h