HTTPHelp.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // HTTPRequest.swift
  3. // SocketChat
  4. //
  5. // Created by Justine on 16/5/30.
  6. // Copyright © 2016年 AppCoda. All rights reserved.
  7. //
  8. import Alamofire
  9. import Foundation
  10. enum HTTPMethod{
  11. case POST
  12. }
  13. class HTTPRequest {
  14. // //创建NSURL对象
  15. // let url:NSURL!
  16. // //创建请求对象
  17. // let urlRequest:NSURLRequest!
  18. // let Method:NSURLRequest.Type
  19. // //响应对象
  20. // var response:NSURLResponse?
  21. // init(Methom:String = "POST",url:String,data:NSData){
  22. // do{
  23. // //替换HttpHeader
  24. // urlRequest.setValue("application/json", forKey: "Content-Type")
  25. // urlRequest.setValue("*", forKey: "accept")
  26. // //发送请求
  27. // //try urlRequest = NSURLRequest(URL:NSURL(string: url)!, cachePolicy: , timeoutInterval: 3.0)
  28. // let data:NSData? = try NSURLConnection.sendSynchronousRequest(urlRequest,returningResponse:&response)
  29. // let str = NSString(data: data!, encoding: NSUTF8StringEncoding)
  30. // print(str)
  31. // }catch let error as NSError{
  32. // //打印错误信息
  33. // print(error.code)
  34. // print(error.description)
  35. // }
  36. // }
  37. //
  38. //
  39. }