Something went wrong. Try again.
A HTTP client built with and for PointFree's swift-dependencies
Something went wrong. Try again.
881 B · 41 lines
Swift
at main
123456789101112131415161718192021222324252627282930313233343536373839404142//// JSONEncoderDependencyKey.swift// swift-dependencies-http//// Created by Woodrow Melling on 10/8/25.//
//// HTTPClient+JSONCoding.swift// //// Created by Woodrow Melling on 8/14/23.//
import Foundationimport Dependencies
internal enum JSONEncoderDependencyKey: DependencyKey { static let liveValue = JSONEncoder() static let testValue = JSONEncoder()}
internal enum JSONDecoderDependencyKey: DependencyKey { static let liveValue = JSONDecoder() static let testValue = JSONDecoder()}
public extension DependencyValues { var jsonEncoder: JSONEncoder { get { self[JSONEncoderDependencyKey.self] } set { self[JSONEncoderDependencyKey.self] = newValue } }
var jsonDecoder: JSONDecoder { get { self[JSONDecoderDependencyKey.self] } set { self[JSONDecoderDependencyKey.self] = newValue } }}