       onError: onError
     )
   }
-  
+
   static func handleSuccess(data: NSData,
     response: NSHTTPURLResponse,
     onSuccess: (UIImage)->(),
     onError: (NSError, NSHTTPURLResponse?)->()) {
-      
+
     // Show error if response code is not 200
     if response.statusCode != 200 {
       onError(MoaHttpImageErrors.HttpStatusCodeIsNot200.new, response)
       return
     }
-    
+
     // Ensure response has the valid MIME type
     if let mimeType = response.MIMEType {
       if !validMimeType(mimeType) {

public enum MoaHttpImageErrors: Int {
  /// Response HTTP status code is not 200.
  case HttpStatusCodeIsNot200 = -1
  
  /// Response is missing Content-Type http header.
  case MissingResponseContentTypeHttpHeader = -2
  
  /// Response Content-Type http header is not an image type.
  case NotAnImageContentTypeInResponseHttpHeader = -3
  
  /// Failed to convert response data to UIImage.
  case FailedToReadImageData = -4


      onError(error, response)
    }
  }

  private static func validMimeType(mimeType: String) -> Bool {
    let validMimeTypes = ["image/jpeg", "image/pjpeg", "image/png"]
    return contains(validMimeTypes, mimeType)
