Get contents of HTML file located in /files

Having trouble getting the contents of an HTML file I stored in the files depot. Curl works:

<pre><code>~ ❯❯❯ curl -i -k 3 -X GET http://localhost:8080/rest/files/applications/cmapp/profile.html -H "X-DreamFactory-Application-Name: cmapp" -H "X-DreamFactory-Session-Token: anq0jjt0a6bv6u9ah51t3g8017"

curl: (7) Couldn’t connect to server
HTTP/1.1 200 OK
Date: Fri, 21 Aug 2015 15:40:51 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
X-Powered-By: PHP/5.5.26
Set-Cookie: PHPSESSID=68qkusa4oi8mv8o1crsrgtr1t4; path=/
Expires: 0
Cache-Control: private
Pragma: public
Set-Cookie: PHPSESSID=anq0jjt0a6bv6u9ah51t3g8017; path=/
Last-Modified: Fri, 21 Aug 2015 14:38:14 GMT
Content-Length: 73
Content-Disposition: inline; filename=“profile.html”;
Vary: Accept-Encoding
Content-Type: text/html;charset=UTF-8

This is test data from the server.

%

But when trying with the iOS api I either get a nil response or “Cannot process response (-1017)”:

func _getProfileHTML() {
    var headerParams = Globals.kHeaderParams
    var session = self.userDefaults.objectForKey(kSessionKey) as! String
    var profileHTML: String!
    
    headerParams["X-DreamFactory-Session-Token"] = session
    println(">>> Inside Sub")
    
    nik.restPath(Globals.kProfileURL,
      method: "GET",
      queryParams: ["content" : "YES", "download" : "YES"],
      body: nil,
      headerParams: headerParams,
      contentType: Globals.kContentTypeJSON,
      completionBlock: {(response: Dictionary!, error: NSError!) in
        if ((error) != nil) {
          profileHTML = "Failed Profile get inside getProfile Block"
          println("error: \(error)")
          self.htmlDelegate?.profileHTMLReturnedWith(profileHTML + ": " + error.localizedDescription)
          self.dbSessionLogout()
        }
        else {
          println(">> DB Session Response: \(response)")
          
          profileHTML = "Got Through"
          self.htmlDelegate?.profileHTMLReturnedWith(profileHTML)
          self.dbSessionLogout()
        }
    })
  }

You can get the file contents in base64 like this:

GET /rest/files/applications/myapp/index.html?include_properties=true&content=true

The response will look like this:

{
	"path": "applications/myapp/index.html",
	"name": "index.html",
	"content_type": "text/html",
	"last_modified": "Mon, 04 May 2015 18:49:31 GMT",
	"content_length": 10305,
	"content": "PGh0bWw+CjxoZWFkPgo8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+C..."
}

You would then base64 decode response.content to get the raw HTML.