params questions

23 views
Skip to first unread message

郑泽楷

unread,
Jul 24, 2013, 11:08:39 PM7/24/13
to ql...@googlegroups.com
I'm new to ql.io, and I have a question about it. When I using monkey path to preprocess my requests, how can I inject variables to the 'params' property from the callback function argument. Something like this:

exports['patch header'] = function(options) {
 
var params = options.params;   // how can I inject variables to this property?
 
// do sth
 
return options.header;
}

exports
['patch body'] = function(options) {
 
var params = options.params;   // same question
 
// do sth
 
return options.body;
}


I also use some way like 'curl --header 'key:value'' send a request to ql.io server, still not in the options.params.

Can anyone tell me how to do that?

Regards, 
Zekai

郑泽楷

unread,
Jul 25, 2013, 10:02:00 PM7/25/13
to ql...@googlegroups.com
founded....The params are in the proto chain of that options.params object....

use this code to print them:

exports['patch header'] = function(options) {
  var params = options.params;

  while(params) {
    console.log(params);
    params = params.__proto__;
  }
  return options.header;
}



Reply all
Reply to author
Forward
0 new messages