Skip to content

Commit 8a8cd12

Browse files
committed
PR fixes
1 parent bb92100 commit 8a8cd12

File tree

2 files changed

+2
-91
lines changed

2 files changed

+2
-91
lines changed

Sources/SwiftHttp/HttpHeaderKey.swift

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,9 @@ public struct HttpHeaderKey {
219219
public static let xVerificaSicurezza: HttpHeaderKey = "X-VerificaSicurezza"
220220
}
221221

222-
extension HttpHeaderKey: Hashable, Codable, ExpressibleByStringLiteral, StringProtocol, RawRepresentable, CustomStringConvertible {
223-
public typealias UTF8View = String.UTF8View
224-
public typealias UTF16View = String.UTF16View
225-
public typealias UnicodeScalarView = String.UnicodeScalarView
222+
extension HttpHeaderKey: Hashable, Codable, ExpressibleByStringLiteral, RawRepresentable, CustomStringConvertible {
226223

227224
public var description: String { rawValue }
228-
public var startIndex: String.Index { rawValue.startIndex }
229-
public var endIndex: String.Index { rawValue.endIndex }
230-
public var utf8: String.UTF8View { rawValue.utf8 }
231-
public var utf16: String.UTF16View { rawValue.utf16 }
232-
public var unicodeScalars: String.UnicodeScalarView { rawValue.unicodeScalars }
233225

234226
/// Creates a new instance with the specified raw value.
235227
/// - Parameter rawValue: The raw value to use for the new instance.
@@ -249,42 +241,7 @@ extension HttpHeaderKey: Hashable, Codable, ExpressibleByStringLiteral, StringPr
249241
public init(from decoder: Decoder) throws {
250242
try self.init(String(from: decoder))
251243
}
252-
253-
/// Creates a string from the given Unicode code units in the specified
254-
/// encoding.
255-
///
256-
/// - Parameters:
257-
/// - codeUnits: A collection of code units encoded in the encoding
258-
/// specified in `sourceEncoding`.
259-
/// - sourceEncoding: The encoding in which `codeUnits` should be
260-
/// interpreted.
261-
262-
public init<C, Encoding>(decoding codeUnits: C, as sourceEncoding: Encoding.Type) where C : Collection, Encoding : _UnicodeEncoding, C.Element == Encoding.CodeUnit {
263-
self.init(String(decoding: codeUnits, as: sourceEncoding))
264-
}
265-
266-
/// Creates a string from the null-terminated, UTF-8 encoded sequence of
267-
/// bytes at the given pointer.
268-
///
269-
/// - Parameter nullTerminatedUTF8: A pointer to a sequence of contiguous,
270-
/// UTF-8 encoded bytes ending just before the first zero byte.
271-
public init(cString nullTerminatedUTF8: UnsafePointer<CChar>) {
272-
self.init(String(cString: nullTerminatedUTF8))
273-
}
274-
275-
/// Creates a string from the null-terminated sequence of bytes at the given
276-
/// pointer.
277-
///
278-
/// - Parameters:
279-
/// - nullTerminatedCodeUnits: A pointer to a sequence of contiguous code
280-
/// units in the encoding specified in `sourceEncoding`, ending just
281-
/// before the first zero code unit.
282-
/// - sourceEncoding: The encoding in which the code units should be
283-
/// interpreted.
284-
public init<Encoding>(decodingCString nullTerminatedCodeUnits: UnsafePointer<Encoding.CodeUnit>, as sourceEncoding: Encoding.Type) where Encoding : _UnicodeEncoding {
285-
self.init(String(decodingCString: nullTerminatedCodeUnits, as: sourceEncoding))
286-
}
287-
244+
288245
/// Hashes the essential components of this value by feeding them into the
289246
/// given hasher.
290247
///
@@ -314,44 +271,4 @@ extension HttpHeaderKey: Hashable, Codable, ExpressibleByStringLiteral, StringPr
314271
public func encode(to encoder: Encoder) throws {
315272
try rawValue.encode(to: encoder)
316273
}
317-
318-
public subscript(position: String.Index) -> Character {
319-
rawValue[position]
320-
}
321-
322-
public subscript(bounds: Range<String.Index>) -> Substring {
323-
rawValue[bounds]
324-
}
325-
326-
public mutating func write(_ string: String) {
327-
rawValue.write(string)
328-
}
329-
330-
public func lowercased() -> String {
331-
rawValue.lowercased()
332-
}
333-
334-
public func uppercased() -> String {
335-
rawValue.uppercased()
336-
}
337-
338-
public func write<Target>(to target: inout Target) where Target : TextOutputStream {
339-
rawValue.write(to: &target)
340-
}
341-
342-
public func withCString<Result>(_ body: (UnsafePointer<CChar>) throws -> Result) rethrows -> Result {
343-
try rawValue.withCString(body)
344-
}
345-
346-
public func withCString<Result, Encoding>(encodedAs targetEncoding: Encoding.Type, _ body: (UnsafePointer<Encoding.CodeUnit>) throws -> Result) rethrows -> Result where Encoding : _UnicodeEncoding {
347-
try rawValue.withCString(encodedAs: targetEncoding, body)
348-
}
349-
350-
public func index(after i: String.Index) -> String.Index {
351-
rawValue.index(after: i)
352-
}
353-
354-
public func index(before i: String.Index) -> String.Index {
355-
rawValue.index(before: i)
356-
}
357274
}

Sources/SwiftHttp/UrlSessionHttpClient.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,3 @@ public struct UrlSessionHttpClient: HttpClient {
133133
}
134134
}
135135
}
136-
137-
extension HttpClient where Self == UrlSessionHttpClient {
138-
public static var urlSession: UrlSessionHttpClient {
139-
UrlSessionHttpClient()
140-
}
141-
}

0 commit comments

Comments
 (0)