Skip to content

Commit b065fd0

Browse files
committed
Removed unnecessary request headers code from DefaultServiceRequest
1 parent f104211 commit b065fd0

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/Google/Spreadsheet/Batch/BatchResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(SimpleXMLElement $xml)
4848
*/
4949
public function getXml()
5050
{
51-
return $this->getXml();
51+
return $this->xml;
5252
}
5353

5454
/**

src/Google/Spreadsheet/CellFeed.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ public function updateBatch(BatchRequest $batchRequest)
146146
public function insertBatch(BatchRequest $batchRequest)
147147
{
148148
$xml = $batchRequest->createRequestXml($this);
149-
$response = ServiceRequestFactory::getInstance()->post($this->getBatchUrl(), $xml, array("If-Match: *"));
149+
$response = ServiceRequestFactory::getInstance()
150+
->setHeaders(array("If-Match" => "*"))
151+
->post($this->getBatchUrl(), $xml);
150152
return new BatchResponse(new SimpleXMLElement($response));
151153
}
152154

@@ -172,12 +174,14 @@ public function getBatchUrl()
172174
/**
173175
* Create a entry to insert data
174176
*
175-
* @param int $row
176-
* @param int $col
177+
* @param int $row
178+
* @param int $col
177179
* @param string $content
180+
*
178181
* @return CellEntry
179182
*/
180-
public function createInsertionCell($row, $col, $content) {
183+
public function createInsertionCell($row, $col, $content)
184+
{
181185
$xml = new SimpleXMLElement('<entry></entry>');
182186
$child = $xml->addChild('content', $content);
183187
$child->addAttribute('type', 'text');

src/Google/Spreadsheet/DefaultServiceRequest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,13 @@ public function get($url)
135135
* Perform a post request
136136
*
137137
* @param string $url
138-
* @param mixed $postData
139-
* @param array $extraHeaders
138+
* @param mixed $postData
139+
*
140140
* @return string
141141
*/
142-
public function post($url, $postData, $extraHeaders = array())
142+
public function post($url, $postData)
143143
{
144-
$headers = array_merge(
145-
array('Content-Type: application/atom+xml'),
146-
$extraHeaders
147-
);
148-
149-
$ch = $this->initRequest($url, $headers);
144+
$ch = $this->initRequest($url, array('Content-Type: application/atom+xml'));
150145
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
151146
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
152147
return $this->execute($ch);

0 commit comments

Comments
 (0)