Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSMutableURLRequestMBS class.

NSMutableURLRequestMBS.addValue(value as string, field as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Adds an HTTP header to the receiver's HTTP header dictionary.
Example
dim m as new NSMutableURLRequestMBS("http://test.test")

m.addValue "Hello", "test"
m.addValue "World", "test"

MsgBox m.valueForHTTPHeaderField("test")

value: The value for the header field.
field: The name of the header field. In keeping with the HTTP RFC, HTTP header field names are case-insensitive

This method provides the ability to add values to header fields incrementally. If a value was previously set for the specified field, the supplied value is appended to the existing value using the appropriate field delimiter. In the case of HTTP, this is a comma.

NSMutableURLRequestMBS.Constructor(url as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an NSURLRequest with the given URL.
Example
dim m as new NSMutableURLRequestMBS("http://test.test")

MsgBox m.URL

Default values are used for cache policy (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 seconds).
On success, handle property is not zero.

See also:

NSMutableURLRequestMBS.Constructor(url as string, cachePolicy as Integer, timeoutInterval as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an NSURLRequest with the given URL.

See also:

NSMutableURLRequestMBS.setAllHTTPHeaderFields(headerFields as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Replaces the receiver's header fields with the passed values.

headerFields: A dictionary with the new header fields. HTTP header fields must be string values; therefore, each object and key in the headerFields dictionary must be a String. If either the key or value for a key-value pair is not a string, the key-value pair is skipped.

Some examples using this method:

NSMutableURLRequestMBS.setAttribution(Attribution as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 21.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the NSURLRequestAttribution to associate with this request.

Defaults to NSURLRequestAttributionDeveloper.

NSMutableURLRequestMBS.setCachePolicy(policy as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the cache policy of the receiver.

policy: The new cache policy.

Available in Mac OS X v10.2 with Safari 1.0 installed.
Available in Mac OS X v10.2.7 and later.

These constants are used to specify interaction with the cached responses.
NSURLRequestUseProtocolCachePolicy = 0,
NSURLRequestReloadIgnoringLocalCacheData = 1,
NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4,
NSURLRequestReturnCacheDataElseLoad = 2,
NSURLRequestReturnCacheDataDontLoad = 3,
NSURLRequestReloadRevalidatingCacheData = 5

NSMutableURLRequestMBS.setHTTPBody(data as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the request body of the receiver to the specified data.

data: The new request body for the receiver. This is sent as the message body of the request, as in an HTTP POST request.

NSMutableURLRequestMBS.setHTTPMethod(HTTPMethod as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the receiver's HTTP request method.
Example
dim m as new NSMutableURLRequestMBS("http://test.test")
m.setHTTPMethod "PUT"
MsgBox m.HTTPMethod

HTTPMethod: The new HTTP request method. The default HTTP method is "GET".

Some examples using this method:

NSMutableURLRequestMBS.setHTTPShouldHandleCookies(should as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets whether the receiver should use the default cookie handling for the request.
Example
dim r as NSURLRequestMBS = NSURLRequestMBS.requestWithURL("http://www.apple.de")
Dim m as NSMutableURLRequestMBS = r.mutableCopy
m.setHTTPShouldHandleCookies(false)
HTMLViewer1.LoadRequest m

handleCookies: True if the receiver should use the default cookie handling for the request, false otherwise. The default is true.

NSMutableURLRequestMBS.setHTTPShouldUsePipelining(shouldUsePipelining as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets whether the request should not wait for the previous response before transmitting.

True if the receiver should transmit before the previous response is received. False to wait for the previous response before transmitting.

Calling this method with a true value does not guarantee HTTP pipelining behavior. HTTP 1.1 allows the client to send multiple requests to the server without waiting for a response.
Though HTTP 1.1 requires support for pipelining, some servers report themselves as being HTTP 1.1 but do not support pipelining. To maintain compatibility with these servers, requests may have to wait for the previous response before transmitting.

Available on Mac OS X 10.7 or newer.

NSMutableURLRequestMBS.setMainDocumentURL(url as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the main document URL for the receiver.
Example
dim m as new NSMutableURLRequestMBS("http://test.test/test.jpg")
m.setMainDocumentURL "http://test.test/"
MsgBox m.mainDocumentURL

url: The new main document URL. Can be nil.

The caller should set the main document URL to an appropriate main document, if known. For example, when loading a web page the URL of the HTML document for the top-level frame would be appropriate. This URL will be used for the "only from same domain as main document" cookie accept policy.
Available in Mac OS X v10.2 with Safari 1.0 installed.
Available in Mac OS X v10.2.7 and later.

NSMutableURLRequestMBS.setNetworkServiceType(networkServiceType as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the NSURLRequestNetworkServiceType to associate with this request.

networkServiceType: The service type to associate with the request.
This method is used to provide the network layers with a hint as to the purpose of the request. Most clients should not need to use this method. See NSURLNetworkServiceType* constants.
Available in Mac OS X 10.7 or newer.

NSMutableURLRequestMBS.setTimeoutInterval(seconds as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the receiver's timeout interval, in seconds.

seconds: The timeout interval, in seconds. If during a connection attempt the request remains idle for longer than the timeout interval, the request is considered to have timed out. The default timeout interval is 60 seconds.

Available in Mac OS X v10.2 with Safari 1.0 installed.
Available in Mac OS X v10.2.7 and later.

Some examples using this method:

NSMutableURLRequestMBS.setURL(url as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the URL of the receiver.

Available in Mac OS X v10.2 with Safari 1.0 installed.
Available in Mac OS X v10.2.7 and later.

NSMutableURLRequestMBS.setValue(value as string, field as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the specified HTTP header field.
Example
dim m as new NSMutableURLRequestMBS("http://test.test")
m.setValue("just a test", "test")
MsgBox m.valueForHTTPHeaderField("test")

value: The new value for the header field. Any existing value for the field is replaced by the new value.
field: The name of the header field to set. In keeping with the HTTP RFC, HTTP header field names are case-insensitive.

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


The biggest plugin in space...