Skip to content

Commit

Permalink
multipart
Browse files Browse the repository at this point in the history
  • Loading branch information
z985342160 committed Aug 19, 2024
1 parent ac66020 commit 2e50b8f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/RequestBuilderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public function getRequest(): RequestInterface
{
$this->beforeBuildRequest();

// Need to be removed, generated by Guzzle
if (isset($this->headers['Content-Type']) && 'multipart/form-data' === $this->headers['Content-Type']) {
unset($this->headers['Content-Type']);
}

return new Request($this->method, $this->getUri(), $this->headers, $this->getBody());
}

Expand Down Expand Up @@ -102,7 +97,7 @@ protected function getBody(): string|StreamInterface|null
{
$contentType = $this->headers['Content-Type'] ?? null;

if ($contentType === 'multipart/form-data') {
if (isset($this->bodyParams[0])) {
return new MultipartStream($this->bodyParams);
} else if ($contentType === 'application/json') {
return $this->jsonEncode($this->bodyParams);
Expand Down

0 comments on commit 2e50b8f

Please sign in to comment.