Skip to content

Commit 867e313

Browse files
committed
Perbaikan Bugs pada request Delete
1 parent c350834 commit 867e313

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

application/libraries/Http_req.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function __get($var) {
109109

110110
public function get($uri, $header = array(), $param = NULL) {
111111

112-
if (isset(self::$headers) && count($header) <= 0) {
112+
if (isset(self::$headers) && $header !== array()) {
113113

114114
$header = self::$headers;
115115

@@ -127,7 +127,7 @@ public function get($uri, $header = array(), $param = NULL) {
127127

128128
public function post($uri, $header = array(), $body = NULL) {
129129

130-
if (isset(self::$headers) && count($header) <= 0) {
130+
if (isset(self::$headers) && $header !== array()) {
131131

132132
$header = self::$headers;
133133

@@ -145,7 +145,7 @@ public function post($uri, $header = array(), $body = NULL) {
145145

146146
public function put($uri, $header = array(), $body = NULL) {
147147

148-
if (isset(self::$headers) && count($header) <= 0) {
148+
if (isset(self::$headers) && $header !== array()) {
149149

150150
$header = self::$headers;
151151

@@ -163,7 +163,7 @@ public function put($uri, $header = array(), $body = NULL) {
163163

164164
public function patch($uri, $header = array(), $body = NULL) {
165165

166-
if (isset(self::$headers) && count($header) <= 0) {
166+
if (isset(self::$headers) && $header !== array()) {
167167

168168
$header = self::$headers;
169169

@@ -181,7 +181,7 @@ public function patch($uri, $header = array(), $body = NULL) {
181181

182182
public function delete($uri, $header = array(), $body = NULL) {
183183

184-
if (isset(self::$headers) && count($header) <= 0) {
184+
if (isset(self::$headers) && $header !== array()) {
185185

186186
$header = self::$headers;
187187

@@ -193,15 +193,15 @@ public function delete($uri, $header = array(), $body = NULL) {
193193

194194
} // end if
195195

196-
return Unirest\Request::post($uri, $header, $body);
196+
return Unirest\Request::delete($uri, $header, $body);
197197

198198
} // end delete
199199

200200
public function custom($method = 'get', $url, $headers = array(), $body = NULL) {
201201

202202
$method = $this->get_method_req($method);
203203

204-
if (isset(self::$headers) && count($headers) <= 0) {
204+
if (NULL !== self::$headers && $headers !== array()) {
205205

206206
$headers = self::$headers;
207207

@@ -339,7 +339,7 @@ public function set_JsonOpt($isassoc = FALSE, $rekusi = 512, $options = JSON_NUM
339339

340340
public function set_Proxy($ip, $port = 1080, $tunneling = FALSE, $type = CURLPROXY_HTTP) {
341341

342-
if ($port != 1080) {
342+
if ($port !== 1080) {
343343

344344
Unirest\Request::proxy($ip, $port, $type);
345345

0 commit comments

Comments
 (0)