shouldAssumesHTTP3Capable method

Call this method to enable the HTTP/3 protocol for the first request of the specified URL.

Note: The shouldAssumesHTTP3Capable method takes effect only when the shouldUseNewSchemeHandler method returns YES that indicates the new scheme handler is used for URLs .

Method signature

copy
func shouldAssumesHTTP3Capable(for url: URL) -> Bool

Parameters

Parameter

Data type

Required

Description

url

String

Yes

Indicates the URL of request.

Return value

Parameter

Data type

Required

Description

N/A

BOOL

Yes

Return the result of whether to use the HTTP/3 protocol.

  • YES: use the HTTP/3 protocol.
  • NO: not to use the HTTP/3 protocol.

Sample

copy
class DemoSchemeTaskHandlerDelegate: NSObject, GRVSchemeTaskHandlerDelegate {
    func shouldAssumesHTTP3Capable(for url: URL) -> Bool {
        if let host = url.host, host == "xxx" {
            return true
        }
        return false
    }
}

Related topic