Skip to content

Commit cfadef1

Browse files
committed
Allows discardableResult where output is Data
Defaults headers and queries to String
1 parent 30648bc commit cfadef1

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Sources/Endpoints/EndpointService.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public extension EndpointService {
124124
/// - domain: The `domain` associated with this endpoint
125125
/// - body: The body data to include in the URLRequest
126126
/// - Returns: The data and response returned for this endpoint request
127+
@discardableResult
127128
func perform<E>(_ endpoint: E) async throws -> (Data, HTTPURLResponse)
128129
where E: EncodableEndpoint, E.Input == Data
129130
{
@@ -136,6 +137,7 @@ public extension EndpointService {
136137
/// - domain: The `domain` associated with this endpoint
137138
/// - body: The encodable body to include in the URLRequest
138139
/// - Returns: The data and response returned for this endpoint request
140+
@discardableResult
139141
func perform<E>(_ endpoint: E) async throws -> (Data, HTTPURLResponse)
140142
where E: EncodableEndpoint
141143
{
@@ -147,6 +149,7 @@ public extension EndpointService {
147149
// MARK: Private
148150

149151
private extension EndpointService {
152+
@discardableResult
150153
func encode<E: EncodableEndpoint>(endpoint: E) throws -> Data {
151154
do {
152155
let result = try endpoint.encode()

Sources/Endpoints/Models/Header.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22

33
public protocol HeaderKey {
4-
associatedtype Value: CustomStringConvertible
4+
associatedtype Value: CustomStringConvertible = String
55
static var name: String { get }
66
}
77

Sources/Endpoints/Models/Query.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import SwiftUI
33

44
public protocol QueryKey {
5-
associatedtype Value: CustomStringConvertible
5+
associatedtype Value: CustomStringConvertible = String
66
static var name: String { get }
77
}
88

0 commit comments

Comments
 (0)