Skip to content

Commit

Permalink
Merge pull request #128 from fgibaux/fix-client-json
Browse files Browse the repository at this point in the history
fix: client to use JSON body in request by default
  • Loading branch information
IsraelOrtuno authored Jun 10, 2023
2 parents 8c50ff7 + e54f554 commit 79a067a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Http/PipedriveClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class PipedriveClient implements Client
*/
protected $isOauth = false;

const DEFAULT_BODY_FORMAT = RequestOptions::JSON;

/**
* GuzzleClient constructor.
*
Expand Down Expand Up @@ -100,7 +102,7 @@ public function get($url, $parameters = [])
public function post($url, $parameters = [])
{
$request = new GuzzleRequest('POST', $url);
$form = 'form_params';
$form = self::DEFAULT_BODY_FORMAT;

// If any file key is found, we will assume we have to convert the data
// into the multipart array structure. Otherwise, we will perform the
Expand Down Expand Up @@ -155,7 +157,7 @@ public function put($url, $parameters = [])
{
$request = new GuzzleRequest('PUT', $url);

return $this->execute($request, ['form_params' => $parameters]);
return $this->execute($request, [self::DEFAULT_BODY_FORMAT => $parameters]);
}

/**
Expand All @@ -168,7 +170,7 @@ public function put($url, $parameters = [])
public function patch($url, $parameters = [])
{
$request = new GuzzleRequest('PATCH', $url);
$form = 'form_params';
$form = self::DEFAULT_BODY_FORMAT;

// If any file key is found, we will assume we have to convert the data
// into the multipart array structure. Otherwise, we will perform the
Expand Down Expand Up @@ -197,7 +199,7 @@ public function delete($url, $parameters = [])
{
$request = new GuzzleRequest('DELETE', $url);

return $this->execute($request, ['form_params' => $parameters]);
return $this->execute($request, [self::DEFAULT_BODY_FORMAT => $parameters]);
}

/**
Expand Down

0 comments on commit 79a067a

Please sign in to comment.