vsouza
5/23/2016 - 2:34 AM

Simple HTTP request. Swift backend implementation

Simple HTTP request. Swift backend implementation

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")
}