Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSURLResponseMBS class.

NSURLResponseMBS.allHeaderFields as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 11.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns all the HTTP header fields of the receiver.

A dictionary containing all the HTTP header fields of the receiver. By examining this dictionary clients can see the "raw" header information returned by the HTTP server.

NSURLResponseMBS.Constructor(URL as string, MimeType as string, expectedContentLength as Integer, textEncodingName as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initialize an NSURLResponse with the provided values.

URL: the URL
MIMETYPE: the MIME content type of the response
expectedContentLength: the expected content length of the associated data
textEncodingName: the name of the text encoding for the associated data, if applicable, else "".

Use -1 for an unknown length.
See also FileExtensionToMimeTypeMBS function.

NSURLResponseMBS.copy as NSURLResponseMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the object.

Makes a copy of the RB object and the NSURLResponse object behind.

NSURLResponseMBS.expectedContentLength as int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the expected content length of the response.

Some protocol implementations report a content length as part of delivering load metadata, but not all protocols guarantee the amount of data that will be delivered in actuality.
Hence, this method returns an expected amount. Clients should use this value as an advisory, and should be prepared to deal with either more or less data.

Returns the expected content length of the receiver, or -1 if there is no expectation that can be arrived at regarding expected content length.

Some examples using this method:

NSURLResponseMBS.isHTTPResponse as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether this response is a http response.

the StatusCode property can only be used on HTTP Responses.

NSURLResponseMBS.MIMEType as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the MIME type of the response.
Example
msgbox HTMLViewer1.mainFrameMBS.DataSource.response.MIMEType

The MIME type is based on the information provided from an origin source. However, that value may be changed or corrected by a protocol implementation if it can be determined that the origin server or source reported the information incorrectly or imprecisely. An attempt to guess the MIME type may be made if the origin source did not report any such information.
See also FileExtensionToMimeTypeMBS function.

NSURLResponseMBS.statusCode as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the HTTP status code of the response.

Returns -1 if no statuscode is available (e.g. in case this is no ta http response)
See also: localizedStringForStatusCode

Some examples using this method:

NSURLResponseMBS.suggestedFilename as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a suggested filename if the resource were saved to disk.

The method first checks if the server has specified a filename using the content disposition header. If no valid filename is specified using that mechanism, this method checks the last path component of the URL. If no valid filename can be obtained using the last path component, this method uses the URL's host as the filename.
If the URL's host can't be converted to a valid filename, the filename "unknown" is used. In mose cases, this method appends the proper file extension based on the MIME type. This method always returns a valid filename.

Some examples using this method:

NSURLResponseMBS.textEncodingName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the name of the text encoding of the response.

This name will be the actual string reported by the origin source during the course of performing a protocol-specific URL load. Clients can inspect this string and convert it to a TextEncoding using the methods and functions made available in the appropriate framework.

Returns the name of the text encoding of the response, or an empty string if no text encoding was specified.

NSURLResponseMBS.URL as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 7.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the URL of the response.
Example
msgbox HTMLViewer1.mainFrameMBS.DataSource.response.URL

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...