<commit_before>//
//  MBRequester.swift
//  Pods
//
//  Created by Perry on 16/7/6.
//
//

import UIKit
import Alamofire
import AlamofireObjectMapper
import ObjectMapper

public extension MBRequestable  {

    /// request
    ///
    /// - Parameters:
    ///   - form:
    ///   - load:
    ///   - serialize: 
    public func request(_ form: MBFormable, load: MBLoadable = MBLoadType.none) -> DataRequest  {
        load.begin()
        return Alamofire.request(form.url, method: form.method, parameters: form.parameters(), encoding: form.encoding(), headers: form.headers()).response(completionHandler: { (response:DefaultDataResponse) in
//            load.end()
        })
    }
    
    public func download(_ form: MBDownloadForm, load: MBLoadable = MBLoadType.none) -> DownloadRequest {
        load.begin()
        return Alamofire.download(form.url, method: form.method, parameters: form.parameters(), encoding: form.encoding(), headers: form.headers(), to: form.destination).response { (response:DefaultDownloadResponse) in<commit_msg>增加自定义 loading<commit_after>//
//  MBRequester.swift
//  Pods
//
//  Created by Perry on 16/7/6.
//
//

import UIKit
import Alamofire
import AlamofireObjectMapper
import ObjectMapper

public extension MBRequestable  {

    /// request
    ///
    /// - Parameters:
    ///   - form:
    ///   - load:
    ///   - serialize: 
    public func request(_ form: MBFormable, load: MBLoadable = MBLoadType.none) -> DataRequest  {
        load.begin()
        return Alamofire.request(form.url, method: form.method, parameters: form.parameters(), encoding: form.encoding(), headers: form.headers()).response(completionHandler: { (response:DefaultDataResponse) in
            load.end()
        })
    }
    
    public func download(_ form: MBDownloadForm, load: MBLoadable = MBLoadType.none) -> DownloadRequest {
        load.begin()
        return Alamofire.download(form.url, method: form.method, parameters: form.parameters(), encoding: form.encoding(), headers: form.headers(), to: form.destination).response { (response:DefaultDownloadResponse) in
{'fraction_non_alphanumeric': 0.1339712918660287, 'fraction_numerical': 0.003827751196172249, 'mean_word_length': 2.886617100371747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1998480', 'n_tokens_mistral': 613, 'n_tokens_neox': 616, 'n_words': 142}