Skip to content

Commit

Permalink
add allowMiddlewares property to Requestable
Browse files Browse the repository at this point in the history
  • Loading branch information
vetrek committed May 2, 2024
1 parent 609b91e commit 726b280
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Source/Endpoint/DownloadEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ public struct DownloadEndpoint: Requestable {
public var queryParameters: QueryParameters?
public let body: HTTPBody? = nil
public let form: MultipartFormData? = nil
public var allowMiddlewares: Bool

public init(
path: String,
isFullPath: Bool = false,conte
method: HTTPMethod = .get,
headers: [String: String] = [:],
useEndpointHeaderOnly: Bool = false,
queryParameters: QueryParameters? = nil
queryParameters: QueryParameters? = nil,
allowMiddlewares: Bool = true
) {
self.path = path
self.isFullPath = isFullPath
self.method = method
self.headers = headers
self.useEndpointHeaderOnly = useEndpointHeaderOnly
self.queryParameters = queryParameters
self.allowMiddlewares = allowMiddlewares
}
}
5 changes: 4 additions & 1 deletion Source/Endpoint/Endpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public struct Endpoint<Value>: Requestable {
public var queryParameters: QueryParameters?
public var body: HTTPBody?
public let form: MultipartFormData? = nil
public var allowMiddlewares: Bool

public init(
path: String,
Expand All @@ -44,7 +45,8 @@ public struct Endpoint<Value>: Requestable {
headers: [String: String] = [:],
useEndpointHeaderOnly: Bool = false,
queryParameters: QueryParameters? = nil,
body: HTTPBody? = nil
body: HTTPBody? = nil,
allowMiddlewares: Bool = true
) {
self.path = path
self.isFullPath = isFullPath
Expand All @@ -53,5 +55,6 @@ public struct Endpoint<Value>: Requestable {
self.useEndpointHeaderOnly = useEndpointHeaderOnly
self.queryParameters = queryParameters
self.body = body
self.allowMiddlewares = allowMiddlewares
}
}
4 changes: 4 additions & 0 deletions Source/Endpoint/MultipartFormEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ public struct MultipartFormEndpoint<Value>: Requestable {
public var useEndpointHeaderOnly: Bool
public var queryParameters: QueryParameters?
public let body: HTTPBody? = nil
public var allowMiddlewares: Bool
public var form: MultipartFormData?


public init(
path: String,
isFullPath: Bool = false,
method: HTTPMethod = .post,
headers: [String: String] = [:],
useEndpointHeaderOnly: Bool = false,
queryParameters: QueryParameters? = nil,
allowMiddlewares: Bool = true,
form: MultipartFormData
) {
self.path = path
Expand All @@ -51,6 +54,7 @@ public struct MultipartFormEndpoint<Value>: Requestable {
self.headers = headers
self.useEndpointHeaderOnly = useEndpointHeaderOnly
self.queryParameters = queryParameters
self.allowMiddlewares = allowMiddlewares
self.form = form
}
}
Expand Down
3 changes: 3 additions & 0 deletions Source/Endpoint/Protocol/Requestable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public protocol Requestable {
/// Multipart Form Data Form
var form: MultipartFormData? { get }

/// Call
var allowMiddlewares: Bool { get }

/// Return the `URLRequest` from the Requestable
func urlRequest(with config: NetworkConfigurable) throws -> URLRequest
}
Expand Down

0 comments on commit 726b280

Please sign in to comment.