Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var observer = require("observer-service");
- const {Cc,Ci,Cu,components} = require("chrome");
- var bs = require("byte-streams");
- function getQuerystring(path){
- s = path.split('?')
- if (s.length == 1) {
- return "";
- } else {
- return s[1];
- }
- }
- function callback(subject, data) {
- var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
- console.log(httpChannel);
- console.log(httpChannel.URI.path);
- console.log(httpChannel.requestMethod);
- var data = '';
- if (httpChannel.requestMethod == 'POST'){
- var post = subject.QueryInterface(Ci.nsIUploadChannel);
- console.log(post);
- console.log(post.uploadStream);
- console.log(bs.ByteReader(post.uploadStream));
- data = "???";
- } else {
- data = getQuerystring(httpChannel.URI.path);
- }
- console.log(data)
- }
- observer.add('http-on-modify-request', callback);
Add Comment
Please, Sign In to add comment