Skip to content

Commit

Permalink
DELETE type authorize failed
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Feb 15, 2022
1 parent c88e9de commit 188dda3
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(array $data)
{
$this->key=$data['key'] ?? '';
$this->secret=$data['secret'] ?? '';
$this->host=$data['host'] ?? 'https://www.mxc.com/';
$this->host=$data['host'] ?? 'https://www.mexc.com/';

$this->options=$data['options'] ?? [];

Expand Down Expand Up @@ -74,7 +74,7 @@ protected function nonce(){
protected function signature(){
if($this->authentication==false) return;

if($this->type=='GET'){
if(in_array($this->type,['GET','DELETE'])) {
$params= empty($this->data) ? '' : implode('&',$this->sort($this->data));
}else{
$params= empty($this->data) ? '' : json_encode($this->data);
Expand Down Expand Up @@ -106,14 +106,6 @@ protected function options(){

$this->options['headers']=$this->headers;
$this->options['timeout'] = $this->options['timeout'] ?? 60;

if(isset($this->options['proxy']) && $this->options['proxy']===true) {
$this->options['proxy']=[
'http' => 'http://127.0.0.1:12333',
'https' => 'http://127.0.0.1:12333',
'no' => ['.cn']
];
}
}

/**
Expand All @@ -124,12 +116,12 @@ protected function send(){

$url=$this->host.$this->path;

if($this->type=='GET') $url.= empty($this->data) ? '' : '?'.http_build_query($this->data);
if(in_array($this->type,['GET','DELETE'])) $url.= empty($this->data) ? '' : '?'.http_build_query($this->data);
else $this->options['body']=json_encode($this->data);

//echo $url.PHP_EOL;
//print_r($this->options);
//die;
// echo $url.PHP_EOL;
// print_r($this->options);
// die;

$response = $client->request($this->type, $url, $this->options);

Expand Down

0 comments on commit 188dda3

Please sign in to comment.