| @@ 87-101 (lines=15) @@ | ||
| 84 | /** |
|
| 85 | * {@inheritdoc} |
|
| 86 | */ |
|
| 87 | public function put($url, $content = '') |
|
| 88 | { |
|
| 89 | $headers = [ |
|
| 90 | 'sfusername: ' . $this->username, |
|
| 91 | 'sfpassword: ' . $this->password, |
|
| 92 | 'Accept: ' . $this->accept, |
|
| 93 | ]; |
|
| 94 | if (is_array($content)) { |
|
| 95 | $content = json_encode($content); |
|
| 96 | $headers[] = 'Content-Type: application/json'; |
|
| 97 | } |
|
| 98 | $response = $this->browser->put($url, $headers, $content); |
|
| 99 | $this->handleResponse($response); |
|
| 100 | return $response->getContent(); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * {@inheritdoc} |
|
| @@ 106-120 (lines=15) @@ | ||
| 103 | /** |
|
| 104 | * {@inheritdoc} |
|
| 105 | */ |
|
| 106 | public function post($url, $content = '') |
|
| 107 | { |
|
| 108 | $headers = [ |
|
| 109 | 'sfusername: ' . $this->username, |
|
| 110 | 'sfpassword: ' . $this->password, |
|
| 111 | 'Accept: ' . $this->accept, |
|
| 112 | ]; |
|
| 113 | if (is_array($content)) { |
|
| 114 | $content = json_encode($content); |
|
| 115 | $headers[] = 'Content-Type: application/json'; |
|
| 116 | } |
|
| 117 | $response = $this->browser->post($url, $headers, $content); |
|
| 118 | $this->handleResponse($response); |
|
| 119 | return $response->getContent(); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * {@inheritdoc} |
|