From c0bcdfd004e80dcf1ee4f70e471c6a10da2627f5 Mon Sep 17 00:00:00 2001 From: Nathan Horter Date: Mon, 9 Jan 2017 13:05:26 -0800 Subject: [PATCH] Agreement Form Data Content Type * A request for the agreement form data requires a content type to be set even if it doesn't match our request. This matches the behavior of the swagger api docs. --- src/Abstracts/Resource.php | 5 ++++- src/Agreements.php | 2 +- src/Transports/GuzzleTransport.php | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Abstracts/Resource.php b/src/Abstracts/Resource.php index 64d4b9c..e7ef285 100644 --- a/src/Abstracts/Resource.php +++ b/src/Abstracts/Resource.php @@ -255,11 +255,14 @@ protected function simpleGetRequest( array $queryString = [ ], $userId = null, $ * @param array $query * @return bool */ - protected function saveFileRequest( $saveToPath, array $query = [ ] ) + protected function saveFileRequest( $saveToPath, array $query = [ ], string $content_type = null ) { $request = new GetRequest( $this->getOAuthToken(), $this->getRequestUrl( $query ) ); $request->setFileSavePath( $saveToPath ); $request->setJsonRequest( false ); + if (!is_null($content_type)) { + $request->setHeader('Content-Type', $content_type); + } $this->setRequest( $request ); $this->logDebug( "GET: " . $this->getRequestUrl( $query ) ); diff --git a/src/Agreements.php b/src/Agreements.php index 06f0a15..b441824 100644 --- a/src/Agreements.php +++ b/src/Agreements.php @@ -156,7 +156,7 @@ public function formData( $agreementId, $saveToPath ) { $this->setApiRequestUrl( $agreementId . '/formData' ); - return $this->saveFileRequest( $saveToPath ); + return $this->saveFileRequest( $saveToPath, array(), 'application/json' ); } /** diff --git a/src/Transports/GuzzleTransport.php b/src/Transports/GuzzleTransport.php index 070a49f..7c12f8e 100644 --- a/src/Transports/GuzzleTransport.php +++ b/src/Transports/GuzzleTransport.php @@ -52,7 +52,6 @@ public function handleRequest( HttpRequest $httpRequest ) $options['multipart'] = $options['body']; unset($options['body']); } - $url = $httpRequest->getRequestUrl();