<commit_before>//
// ResponseDetective.playground
//
// Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved.
// Licensed under the MIT License.
//

import Foundation
import ResponseDetective
import XCPlayground

// Enable indefinite execution so that requests complete before the playground
// is killed.
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

//: ---

// Start by creating a session configuration that includes ResponseDetective's
// interception mechanisms.
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
ResponseDetective.enableInURLSessionConfiguration(configuration)

// And use the above configuration to create your session instance.
let session = NSURLSession(configuration: configuration)

//: ---

// Now, just create a request and resume its session data task.
let request = NSURLRequest(URL: NSURL(string: "https://httpbin.org/get")!)
session.dataTaskWithRequest(request).resume()

// Watch the console! 🎉<commit_msg>Add vertical spaces in playground source<commit_after>//
// ResponseDetective.playground
//
// Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved.
// Licensed under the MIT License.
//

import Foundation
import ResponseDetective
import XCPlayground

// Enable indefinite execution so that requests complete before the playground
// is killed.

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

//: ---

// Start by creating a session configuration that includes ResponseDetective's
// interception mechanisms.

let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
ResponseDetective.enableInURLSessionConfiguration(configuration)

// And use the above configuration to create your session instance.

let session = NSURLSession(configuration: configuration)

//: ---

// Now, just create a request and resume its session data task.

let request = NSURLRequest(URL: NSURL(string: "https://httpbin.org/get")!)
session.dataTaskWithRequest(request).resume()

// Watch the console! 🎉
{'fraction_non_alphanumeric': 0.09177057356608478, 'fraction_numerical': 0.00399002493765586, 'mean_word_length': 4.731428571428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5314312', 'n_tokens_mistral': 533, 'n_tokens_neox': 511, 'n_words': 178}