---
title: "canHandle(_:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsurlconnection/canhandle(_:)"
---

# canHandle(_:)

Returns whether a request can be handled based on a preflight evaluation.

## Declaration

```swift
class func canHandle(_ request: URLRequest) -> Bool
```

## Parameters

- `request`: The request to evaluate. The connection deep-copies the request on creation.

## Return Value

Return Value true if a preflight operation determines that a connection with request can be created and the associated I/O can be started, false otherwise.

## Discussion

Discussion The result of this method is valid as long as no URLProtocol classes are registered or unregistered, and request remains unchanged. Applications should be prepared to handle failures even if they have performed request preflighting by calling this method.

## See Also

### Related Documentation

- [unregisterClass(_:)](foundation/urlprotocol/unregisterclass(_:).md)
- [registerClass(_:)](foundation/urlprotocol/registerclass(_:).md)
- [URL Loading System](foundation/url-loading-system.md)
