Skip to content

Commit

Permalink
refactor(AbstractEntrepotApiService): postFile devient SendFile (POST…
Browse files Browse the repository at this point in the history
… ou PUT)
  • Loading branch information
ocruze committed Nov 21, 2023
1 parent 84bd859 commit 746ce97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Services/EntrepotApi/AbstractEntrepotApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function setEntrepotApiService(EntrepotApiService $entrepotApiService): s
* @param array<mixed> $formFields correspond à "Request Body" dans le swagger
* @param array<mixed> $query correspond aux paramètes "Query" dans le swagger
*/
protected function postFile(string $url, string $filepath, array $formFields = [], array $query = []): array
protected function sendFile(string $method, string $url, string $filepath, array $formFields = [], array $query = []): array
{
$formFields['file'] = DataPart::fromPath($filepath); // ajout du fichier dans $formFields
$formData = new FormDataPart($formFields);

$body = $formData->bodyToIterable();
$headers = $formData->getPreparedHeaders()->toArray();

return $this->request('POST', $url, $body, $query, $headers, true);
return $this->request($method, $url, $body, $query, $headers, true);
}

/**
Expand Down

0 comments on commit 746ce97

Please sign in to comment.