Implemented the UserAgentMiddleware type in the library target.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the DiscogsService open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors
|
||||
// Licensed under Apache license v2.0
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of DiscogsService project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import struct HTTPTypes.HTTPFields
|
||||
import struct HTTPTypes.HTTPRequest
|
||||
|
||||
extension HTTPRequest {
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
/// Initializes a HTTP request conveniently.
|
||||
/// - Parameters:
|
||||
/// - method: A request method.
|
||||
/// - path: A value of the “:path” pseudo header field.
|
||||
/// - headerFields: A dictionary of request header fields.
|
||||
init(
|
||||
method: HTTPRequest.Method = .get,
|
||||
path: String?,
|
||||
headerFields: HTTPFields = [:]
|
||||
) {
|
||||
self.init(
|
||||
method: method,
|
||||
scheme: nil,
|
||||
authority: nil,
|
||||
path: path,
|
||||
headerFields: headerFields
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the DiscogsService open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors
|
||||
// Licensed under Apache license v2.0
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of DiscogsService project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
extension String {
|
||||
/// A namespace assigned for string samples on test cases.
|
||||
enum Sample {
|
||||
/// An operation ID sample.
|
||||
static let operationId = "SomeOperationId"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the DiscogsService open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors
|
||||
// Licensed under Apache license v2.0
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of DiscogsService project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import Foundation
|
||||
|
||||
extension URL {
|
||||
/// A namespace assigned for URL samples on test cases.
|
||||
enum Sample {
|
||||
/// A base URL sample.
|
||||
static let baseURL = URL(string: "https://sample.domain.com")!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user