Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/BatchRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,23 @@ public function execute()
$boundary = $this->generateBoundary();
$batchContent = $this->buildBatchContent($boundary);

// Create a custom request for batch operation with proper content type
$request = $this->client->request(
// Store original custom headers to restore them after the batch request
$originalHeaders = $this->client->getHeaders();

// Set the correct Content-Type header for batch requests
$this->client->addHeader('Content-Type', "multipart/mixed; boundary={$boundary}");

// Create the batch request
$response = $this->client->request(
HttpMethod::POST,
'$batch',
$batchContent
);

return $request;
// Restore original custom headers for future requests
$this->client->setHeaders($originalHeaders);

return $response;
}

/**
Expand Down