fixed request for change observable

This commit is contained in:
Philipp Kunz 2016-07-29 20:41:27 +02:00
parent 09911328b2
commit 2a1fcd8cdb
2 changed files with 34 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -121,7 +121,21 @@ export class Dockersock {
});
};
getChangeObservable(){
let requestStream = plugins.request.get(this.sockPath + "/events");
let options = {
method:"GET",
url:this.sockPath + "/events",
headers:{
"Content-Type":"application/json",
"Host":"docker.sock"
}
};
let requestStream = plugins.request(options,(err, res, body) => {
if (!err && res.statusCode == 200) {
} else {
console.log(err);
console.log(res);
};
});
requestStream.on("response",(response) => {
if(response.statusCode == 200){
plugins.beautylog.ok("request returned status 200, so we are good!");
@ -130,8 +144,7 @@ export class Dockersock {
}
});
let changeObservable = Observable.fromEvent(requestStream,"data");
requestStream.on("end",()=> {
requestStream.on("end",()=> {
});
return changeObservable;
}