-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Example Use Case
When needing to set headers for a request.
extension URLRequest {
mutating func dataTaskPublish(method: String = "GET", withBody body: Data? = nil) -> URLSession.DataTaskPublisher {
let headers = [
"Content-Type": "application/json; charset=utf-8",
"cache-control": "no-cache",
]
httpMethod = method
allHTTPHeaderFields = headers
if let body = body {
httpBody = body
}
let session = URLSession.shared
return session.dataTaskPublisher(for: self)
}
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request