fixed request for change observable
This commit is contained in:
parent
09911328b2
commit
2a1fcd8cdb
20
dist/dockersock.classes.dockersock.js
vendored
20
dist/dockersock.classes.dockersock.js
vendored
File diff suppressed because one or more lines are too long
@ -121,7 +121,21 @@ export class Dockersock {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
getChangeObservable(){
|
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) => {
|
requestStream.on("response",(response) => {
|
||||||
if(response.statusCode == 200){
|
if(response.statusCode == 200){
|
||||||
plugins.beautylog.ok("request returned status 200, so we are good!");
|
plugins.beautylog.ok("request returned status 200, so we are good!");
|
||||||
@ -131,7 +145,6 @@ export class Dockersock {
|
|||||||
});
|
});
|
||||||
let changeObservable = Observable.fromEvent(requestStream,"data");
|
let changeObservable = Observable.fromEvent(requestStream,"data");
|
||||||
requestStream.on("end",()=> {
|
requestStream.on("end",()=> {
|
||||||
|
|
||||||
});
|
});
|
||||||
return changeObservable;
|
return changeObservable;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user