Skip to content

Commit

Permalink
Merge pull request #68 from brianjmiller/remotelrs-proxy
Browse files Browse the repository at this point in the history
Add `proxy` option to RemoteLRS
  • Loading branch information
brianjmiller authored Aug 22, 2016
2 parents 027759c + 3bdf969 commit 9cba2f3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/RemoteLRS.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class RemoteLRS implements LRSInterface
protected $endpoint;
protected $version;
protected $auth;
protected $proxy;
protected $headers;
protected $extended;

public function __construct() {
Expand Down Expand Up @@ -100,6 +102,15 @@ protected function sendRequest($method, $resource) {
if (isset($this->auth)) {
array_push($http['header'], 'Authorization: ' . $this->auth);
}
if (isset($this->proxy)) {
$http['proxy'] = $this->proxy;
}

if (isset($this->headers) && count($this->headers) > 0) {
foreach ($this->headers as $k => $v) {
array_push($http['header'], "$k: $v");
}
}

if (isset($options['headers'])) {
foreach ($options['headers'] as $k => $v) {
Expand Down Expand Up @@ -1169,4 +1180,16 @@ public function setAuth() {
return $this;
}
public function getAuth() { return $this->auth; }

public function setProxy($value) {
$this->proxy = $value;
return $this;
}
public function getProxy() { return $this->proxy; }

public function setHeaders($value) {
$this->headers = $value;
return $this;
}
public function getHeaders() { return $this->headers; }
}

0 comments on commit 9cba2f3

Please sign in to comment.