HtmlResponse.swift 538 B

123456789101112131415161718192021
  1. //
  2. // HtmlResponse.swift
  3. // Swifter
  4. //
  5. // Created by Dawid Szymczak on 15/08/16.
  6. // Copyright © 2016 Damian Kołakowski. All rights reserved.
  7. //
  8. #if os(Linux)
  9. import Glibc
  10. #else
  11. import Foundation
  12. #endif
  13. public class HtmlResponse: Response {
  14. public override func content() -> (contentLength: Int, contentString: String) {
  15. let serialised = "<html><meta charset=\"UTF-8\"><body>\(String(self.contentObject))</body></html>"
  16. let data = [UInt8](serialised.utf8)
  17. return (data.count, serialised)
  18. }
  19. }