Up

# NSURLResponse documentation

### Authors

Generated by Debian

### Contents -

1. Software documentation for the NSHTTPURLResponse class
2. Software documentation for the NSURLResponse class

# Software documentation for the NSHTTPURLResponse class

## NSHTTPURLResponse : NSURLResponse

> Declared in:
>   Foundation/NSURLResponse.h

Availability: MacOS-X 10.2.0
HTTP specific additions to an NSURLResponse
Method summary

- +localizedStringForStatusCode:
- -allHeaderFields
- -statusCode

### localizedStringForStatusCode:

+ (NSString*) localizedStringForStatusCode: (NSInteger)statusCode;
Availability: MacOS-X 10.2.0
Returns a string representation of a status code.

### allHeaderFields

- (NSDictionary*) allHeaderFields;
Availability: MacOS-X 10.2.0
Returns a dictionary containing all the HTTP header fields.

### statusCode

- (NSInteger) statusCode;
Availability: MacOS-X 10.2.0
Returns the HTTP status code for the response.

# Software documentation for the NSURLResponse class

## NSURLResponse : NSObject

> Declared in:
>   Foundation/NSURLResponse.h

> Conforms to:
>   NSCoding
>   NSCopying

Availability: MacOS-X 10.2.0
The response to an NSURLRequest

Instance Variables
Method summary

- -MIMEType
- -URL
- -expectedContentLength
- -initWithURL:MIMEType:expectedContentLength:textEncodingName:
- -initWithURL:statusCode:HTTPVersion:headerFields:
- -suggestedFilename
- -textEncodingName

### MIMEType

- (NSString*) MIMEType;
Availability: MacOS-X 10.2.0
Returns the receiver's MIME type.

### URL

- (NSURL*) URL;
Availability: MacOS-X 10.2.0
Returns the receiver's URL.

### expectedContentLength

- (long long) expectedContentLength;
Availability: MacOS-X 10.2.0
Returns the expected content length of the receiver or -1 if there is no idea of what the content length might be.
This value is advisory, not a definitive length.

### initWithURL: MIMEType: expectedContentLength: textEncodingName:

- (id) initWithURL: (NSURL*)URL MIMEType: (NSString*)MIMEType expectedContentLength: (NSInteger)length textEncodingName: (NSString*)name;
Availability: MacOS-X 10.2.0
Initialises the receiver with the URL, MIMEType, expected length and text encoding name provided.

### initWithURL: statusCode: HTTPVersion: headerFields:

- (id) initWithURL: (NSURL*)URL statusCode: (NSInteger)statusCode HTTPVersion: (NSString*)HTTPVersion headerFields: (NSDictionary*)headerFields;
Availability: MacOS-X 10.7.0
Initialises the receiver with the URL, statusCode, HTTPVersion, and headerFields provided.

### suggestedFilename

- (NSString*) suggestedFilename;
Availability: MacOS-X 10.2.0
Returns a suggested file name for storing the response data, with suggested names being found in the following order:

- content-disposition header
- last path component of URL
- host name from URL
- 'unknown'

If possible, an extension based on the MIME type of the response is also appended.
The result should always be a valid file name.

### textEncodingName

- (NSString*) textEncodingName;
Availability: MacOS-X 10.2.0
Returns the name of the character set used where response data is text

## Instance Variables for NSURLResponse Class

### _NSURLResponseInternal

@protected void* _NSURLResponseInternal;
Availability: MacOS-X 10.2.0
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up