Changelog.md
NetworkLoggerPlugin.default and NetworkLoggerPlugin.verbose to conveniently access the default plugins. #2095 by @sunshinejr.Hashable && Equatable implementation of Endpoint since it was returning false positives. #2101 by @sunshinejr.MultiPartFormData is now Hashable. #2101 by @sunshinejr.AccessTokenPlugin now uses TargetType, instead of AuthorizationType, in the closure to determine the token. Full MultiTarget integration added as well. #2046 by @Coder-ZJQ.Target.sampleData is now automatically implemented as Data() with default protocol extension. #2015 by jdisho.RxSwift is now 6.0. #2120 by @peagasilva.trackInflights option in certain circumstances would return a cached response for an endpoint that's not really the same. #2101 by @sunshinejr.willSend(_:target:) from being fired. #2192 by anton-plebanovich.Alamofire is now 5.0. #1992 by @sunshinejr.MultiTarget now implements AccessTokenAuthorizable so that the inner target's authorizationType is correctly returned to the AccessTokenPlugin when requested. #1979 by @amaurydavid.AccessTokenPlugin, the token closure now takes a AuthorizationType as parameter and AuthorizationType.none has been removed in favor of using AuthorizationType?. #1969 by @amaurydavid.Alamofire is now 5.0.0-rc.3. #1944 by @sunshinejr.NetworkLoggerPlugin. #1916 by @sunshinejr.NetworkLoggerPlugin. #1916 by @sunshinejr.URLRequest changes (created by plugins) when stubbed. #1921 by @sunshinejr.Alamofire is now 5.0.0-rc.2. #1912 by @sunshinejr.swift test again. #1896 by @sunshinejr.Alamofire is now 5.0.0-rc.1. #1909 by @sunshinejr.NetworkLoggerPlugin now logs error when available (using LogOptions.verbose or specyfing errorResponseBody in your LogOptions). #1880 by @amaurydavid.RequestType now has sessionHeaders! These are the headers that are added when the request is added to a session. #1878 by @sunshinejr.Alamofire is now 5.0.0-beta.7. #1810 by @sunshinejr.Result depndency in favor of Result introduced in Swift 5. #1858 by @larryonoff.TargetType parameter in the output of NetworkLoggerPlugin. #1866 by @hasankose.NetworkLoggerPlugin uses the newly added sessionHeaders and now logs all the headers that the request will produce. #1878 by @sunshinejr.RxSwift is now 5.0. #1846 by @LucianoPAlmeida.ReactiveSwift is now 6.0. #1849 by @sunshinejr.``.mapImage() extension on Single and Observable now returns non-optional image. #1789, #1799 by @bjarkehs and @sunshinejr.ReactiveSwift is now 5.0. #1817 by @larryonoff.Result is now 4.1. #1817 by @larryonoff.MoyaError now conforms to CustomNSError protocol, makes underlying errors available in its user-info dictionary. #1783 by @dpoggi.Progress object on responses that did not specify correct Content-Length header. Now, whenever there is no valid header, the progress will be 0.0 until the completion of the request. Also, the completed property is now true only when the response was serialized, we do not rely on progress being 1.0 anymore. #1815 by @sunshinejr.validate on TargetType. It was deprecated in Moya 11, use validationType instead. #1828 by @sunshinejr..custom(String) authorization case to AuthorizationType inside AccessTokenPlugin. #1611 by @SeRG1k17.Breaking Change Minimum version of ReactiveSwift is now 4.0. #1668 by @sunshinejr.
Breaking Change Minimum version of Result is now 4.0. #1668 by @sunshinejr.
Breaking Change Changed Responses filter method parameter to use a generic RangeExpression that accepts any range type. #1624 by @LucianoPAlmeida.
Breaking Change Changed AccessTokenPlugin's initializer to no longer use an @autoclosure for the tokenClosure parameter. #1611 by @SeRG1k17.
.uploadMultipart requests.
#1591 by @SD10..requestCustomJSONEncodable case to Task. #1443 by @evgeny-sureev.failsOnEmptyData boolean support for the Decodable map functions. #1508 by @jeroenbb94.ReactiveSwift to 3.0.
#1470 by @larryonoff.validate property of TargetType to use new ValidationType enum representing valid status codes. #1505 by @SD10, @amaurydavid..uploadMultipart, .uploadCompositeMultipart, .uploadFile, .downloadDestination, and .downloadParameters tasks through an endpointClosure has no effect on the final request.
#1550 by @SD10, @sunshinejr.URLEncoding.httpBody wasn't allowed as bodyEncoding in Task.requestCompositeParameters(). #1557 by @sunshinejr.Decodable mapping to object other than Array and Dictionary in a key path cause crash. #1405 by @ufosky..requestJSONEncodable #1410 by @Vict0rS..parameterEncoding case to MoyaError. #1248 by @SD10..objectMapping case to MoyaError. #1335 by @devxoul..encodableMapping case to MoyaError. #1349 by @LeLuckyVint, @afonsograca and @sunshinejr..requestJSONEncodable case to Task. #1349 by @LeLuckyVint, @afonsograca and @sunshinejr.Decodable object mapping methods to Moya.Response. #1335 by @devxoul.Endpoint.init so it doesn't have any default arguments (removing default argument .get for method parameter and nil for httpHeaderFields parameter). #1289 by @sunshinejr.NetworkActivityPlugin so its networkActivityClosure has now target: TargetType argument in addition to change: NetworkActivityChangeType. #1290 by @sunshinejr.Endpoint's urlRequest property to urlRequest() a throwing method. #1248 by @SD10.Endpoint initializerparameters & parameterEncoding in TargetType with extended Task cases.UploadType and DownloadType into Task cases.shouldAuthorize: Bool in AccessTokenAuthorizable with authorizationType: AuthorizationType.token in AccessTokenPlugin with tokenClosure.TargetTypes no longer receive the Authorization: Bearer <token> header by default when using AccessTokenPlugin.filter/map operators that were available for Observable<Response> to Single<Response> as well.AuthorizationType to AccessTokenAuthorizable representing request headers of .none, .basic, and .bearer.Single<Response> operators.Progress object into the response when calling progress callback on completion.URLRequest from Task.MoyaError.headers to TargetType.RxMoyaProvider.request to return a Single<Request>.Moya.Response's responseto use an HTTPURLResponse instead of a URLResponse.queue to callbackQueue.ReactiveSwiftMoyaProvider and RxSwiftMoyaProvider. Use MoyaProvider with reactive properties now: provider.reactive._, provider.rx._. In case you were subclassing reactive providers, please take a look at this PR from Eidolon. It covers migration from subclassing given providers, to usage by composition.requestWithProgress for ReactiveSwiftMoyaProvider.Moya.Error, endpointByAddingParameters(parameters:), endpointByAddingHttpHeaderFields(httpHeaderFields:), endpointByAddingParameterEncoding(newParameterEncoding:), endpointByAdding(parameters:httpHeaderFields:parameterEncoding), StructTarget, filterStatusCodes(range:), filterStatusCode(code:), willSendRequest(request:target:), didReceiveResponse(result:target:), ReactiveCocoaMoyaProvider, ReactiveSwiftMoyaProvider.request(token:).URL(target:) initializator that creates url from TargetType.requestDataFormatterin NetworkLoggerPlugin to allow the client to interact with the request data before logging it.Fixed a bug where you would have two response events in requestWithProgress method on ReactiveSwift module.
Enabled the "Allow app extension API only" flag.
Updated minimum version of RxSwift to 3.3.
Updated minimum version of ReactiveSwift to 2.0.
requestWithProgress method on RxMoya module.DateSchedulerProtocol to DateScheduler.path to baseURL when path is not empty.reversedPrint arguments for output.Moya.Error to MoyaError in MoyaAvailablity for Swift 3.1 compatibility.RxMoyaProvider never sends next or errors if it's disposed before a subscription is made.Moya.Error to MoyaError.verbose in the NetworkLoggerPlugin to isVerbose.TargetType now specifies its ParameterEncoding.Moya.Error.data.adding(newHttpHeaderFields:) to adding(newHTTPHeaderFields:).AccessTokenPlugin for easier authorization.AccessTokenAuthorizable protocol for optionally controlling the authorization behavior of TargetTypes when using AccessTokenPlugin.Moya.Error now conforms to LocalizedError protocol.TargetType and associated data structures.MultiTarget to project.ReactiveCocoaMoyaProvider to ReactiveSwiftMoyaProvider.PluginType functions to comply with Swift 3 design guideline:
willSendRequest renamed to willSend.didReceiveResponse renamed to didReceive.filterStatusCodes(:) to filter(statusCodes:) (and filterStatusCode(:) to filter(statusCode:)).request(token:) to simply request(:_) (ReactiveSwift).notifyPluginsOfImpendingStub(request:) to notifyPluginsOfImpendingStub(for:).ReactiveCocoa subspec to ReactiveSwift.PluginType can now modify requests and responses through prepare and processcancelled in the Cancellable protocol to isCancelled.URL in Endpoint to url.StructTarget to MultiTarget.TargetType, to allow enabling Alamofire automatic validation on requests.mapString(atKeyPath:) to Response, SignalProducerProtocol, and ObservableTypeclass funcs mimicking enum cases lowercased.willSendRequest and didReceiveResponse in PluginType.String(data:encoding:) instead of NSString(data:encoding:) while converting Data to String.Error.jsonMapping when mapJSON fails to parse JSON.endpointByAddingHTTPHeaders to adding(newHttpHeaderFields:).endpointByAddingParameters to adding(newParameters:).endpointByAddingParameterEncoding to adding(newParameterEncoding:).endpointByAdding(parameters:httpHeaderFields:parameterEncoding) to adding(parameters:httpHeaderFields:parameterEncoding).urlRequest property of Endpoint is now truly optional. The request will fail if the urlRequest turns out to be nil and a requestMapping error will be returned together with the problematic url.StreamRequest typealias that was causing watchOS failures.SampleResponseClosure which allows mocking of the whole URLResponse.SampleResponseClosure case.Swift 3 in favor of Swift 2.x.fileName and mimeType are now optional properties on a MultipartFormData object.appendBodyPart method id called in MultipartFormData.multipartBody from TargetType protocol and adds a task instead..Success Results.supportsMultipart to the Method type, which helps determine whether to use multipart/form-data encoding.PATCH and CONNECT to the Method cases which support multipart encoding.request for Response.Moya.swift into multiple files.mapJSON API to include an optional named parameter failsOnEmptyData: that when overridden returns an empty NSNull() result instead of throwing an error when the response data is empty.RACSignal.Moya.Error.Underlying to have NSError instead of ErrorType.trackInflights = true to your provider.MoyaProvider.RequestClosure to have Result<NSURLRequest, Moya.Error> -> Void instead of NSURLRequest -> Void as a done closure parameter.dispatch_semaphor to avoid deadlocks.queue parameter to request and sendRequest. This open up option to use other queue instead of main queue for response callback.convertResponseToResult public to make use of this method when dealing with Alamofire directlyparameters or headers when parameters or headers or nil.response computed property to Error type, which yields a Response object if available.endpointByAdding method.ParameterEncoding and make it a public typealias of Alamofire.ParameterEncoding.DefaultAlamofireManager as parameter's default value instead of the singleton Alamofire.Manager.sharedinstance is now used when instantiating ReactiveCocoaMoyaProvider and RxMoyaProvider as well.DefaultAlamofireManager as parameter's default value instead of passing the singleton Alamofire.Manager.sharedinstance when initialize a providerMoyaTarget protocol to TargetTypeMoyaRequest protocol to RequestTypePlugin protocol to PluginTypeMoya.Method to Alamofire.Method since it was unusedNetworkLoggingPlugin's initializer to also take a function that has the same signature as print to simplify testingParameterEncoding's parameterEncoding method to toAlamofire and makes it internal onlyPlugin<Target> is now a protocol and as such no longer sends a typed MoyaProvider. - @swizzlrMoya are now defined at the top level; you should find no compatibility issues since they are still invoked by Moya.X – @swizzlrCompletion closure now returns a Result instead of multiple optional parameters.MoyaResponse is now Response, and also final. It will be changed to a struct in a future release. - @swizzlrReactiveCocoaMoyaProvider can now be supplied with an optional stubScheduler – @swizzlr (sponsored by Network Locum)Error type for use with reactive extensions - @tomburnsMoyaResponseSignalProducer from ReactiveCocoa extension – @JRHeatondeferred() from RxSwift extension~> 3.0mapImage() RxSwift function to use UIImage! instead of UIImage.parameters on MoyaTarget an optional [String: AnyObject] dictionary.parameters and httpHeaderFields on Endpoint to be optionals.Moya.StubbedBehavior renamed to Moya.StubBehaviorMoya.MoyaStubbedBehavior renamed to Moya.StubClosureMoya.NoStubbingBehavior -> Moya.NeverStubMoya.ImmediateStubbingBehaviour -> Moya.ImmediatelyStubMoya.DelayedStubbingBehaviour -> Moya.DelayedStubMoyaProvider.MoyaEndpointsClosure to MoyaProvider.EndpointClosureMoyaProvider.MoyaEndpointResolution to MoyaProvider.RequestClosureMoyaProvider.endpointResolver to MoyaProvider.requestClosureMoyaProvider.stubBehavior to MoyaProvider.stubClosureMoyaCredentialClosure to CredentialClosureMoyaProvider initializer parameter namesMoyaCompletion to Moya.CompletionDefaultEndpointResolution to DefaultRequestMappingT generic types of MoyaProvider and Endpoint classes to Target.DefaultEndpointResolutionEndpoints to NSURLRequests asynchonous.EndpointSampleResponse cases: Breaking Change
Success to NetworkResponse, now contains NSData instead of () -> NSData.Error to NetworkErrorNetworkError no longer has a status code or data associated with it. This represents an error from the underlying iOS network stack, like an inability to connect. See #200 for more details.Closure case (see below).Endpoint to use a sampleResponseClosure instead of a sampleResponse, making all sample responses lazily executed. Breaking ChangenetworkActivityClosure with a plugin.token to target (it was usually target anyway, just made it consistent).ReactiveCocoaMoyaProvider to use SignalProducer instead of RACSignalRxMoyaProviderendpointByAddingParameterEncoding method.DefaultEnpointResolution to DefaultEndpointResolution on MoyaProvider class. DefaultEndpointResolution is now used internally as the default resolver. DefaultEnpointResolution can be removed in a future major release.Alamofire.Manager to MoyaProvider initializerpod try compatbility.MoyaPath and MoyaTarget protocols.Moya/Reactive subspec to Moya/ReactiveCocoa.stubResponses from initializer; replaced with new stubbing behavior .NoStubbing. Added class methods to MoyaProvider to provide defaults, while allowing users to still change stubbing behavior on a per-request basis.DefaultEndpointMapping and DefaultEnpointResolution class functions on MoyaProvider. You no longer invoke these functions to return a closure, rather, you reference the functions themselves as closures.endpointsClosure parameter and property of MoyaProvider to endpointClosure.ReactiveMoyaProvider to ReactiveCocoaMoyaProvider for consistency.ReactiveMoyaProvider initializer would not respect the stubbing behavior it was passed.RxMoyaProvider would not respect customized stubbing behavior (delays).EndpointSampleResponse to require closures that return NSData, not NSData instances themselves. This prevents sample data from being loaded during the normal, non-unit test app lifecycle.method to MoyaTarget protocol and removes method parameter from request() functions. Targets now specify GET, POST, etc on a per-target level, instead of per-request.parameters to MoyaTarget protocol and removes ability to pass parameters into request() functions. Targets now specify the parameters directly on a per-target level, instead of per-request.MoyaProvider initializer's endpointsClosure parameter.3.0.0-aplha.1 of ReactiveCocoa. -@ashfurrowdispatch_async to defer it to the next invocation of the run loop. This is a breaking change. Because of this change, the ReactiveCocoa extensions had to be modified slightly to deduplicate inflight stubbed requests. Reactive providers now vend RACSignal instances that start the network request when subscribed to. -@ashfurrow