Last active
May 31, 2016 13:21
-
-
Save vsouza/4d7bfa47864f2be07a3272bcacd28542 to your computer and use it in GitHub Desktop.
Simple HTTP request. Swift backend implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HTTP | |
import File | |
import HTTPSClient | |
import JSON | |
var url: String? | |
do { | |
let client = try! Client(uri: "https://api.github.com:443") | |
var response = try client.get("/repos/vsouza/awesome-ios/git/trees/HEAD") | |
let buffer = try response.body.becomeBuffer() | |
let parsed = try! JSONParser().parse(data: buffer) | |
print(parsed) | |
} catch { | |
print("Response error") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment