[APE Project] Http response : empty headers

18 views
Skip to first unread message

hadrienb

unread,
Jun 16, 2010, 5:02:26 AM6/16/10
to APE Project
Hello,

Here is something I can't resolve :

on the server side, I launch a Http request and I'm receiving the
response I'm waiting for.
So it's working properly but when I tried to read the headers of this
response it appeared to be empty...
The status value is '200', the body is ok but nothing (not "undefined"
or "object".. just nothing) in the headers.


Here is my server side javascript code :
(I also edited the Http.js file to get the entire response object, not
just the body...)

request.getContent(function(result) {
Ape.log('STATUS : '+result['status']);
Ape.log('HEADERS : '+result['headers']);
Ape.log('BODY : '+result['body']);

Ape.getPipe(params.pipe).sendRaw("data",
{"msg":result});
});


Something wierd (or not, I'm not sure^^) on the client side, after I
sent the response object through the sendRaw() function, the headers
is not empty but its value is '0'.


Could I have some help and/or explanation please? Thank you :)

Anthony Catel

unread,
Jun 16, 2010, 5:21:45 AM6/16/10
to ape-p...@googlegroups.com
Hi,

What about :

var request = new Http('http://www.google.fr/');
request.finish(function(result) {
for (var x in result['headers']) {
if (result['headers'].hasOwnProperty(x)) Ape.log(x);
}
});

(getContent doesn't return an object, you must use "finish" method).

Anthony

hadrienb a �crit :

hadrienb

unread,
Jun 16, 2010, 5:37:42 AM6/16/10
to APE Project
Yes it works !

Thx for your quick answer !
Reply all
Reply to author
Forward
0 new messages