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