Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
### Added
- phpstan static analyses (dev)

## [3.0.1] - 2022-02-25
### Fixed
- File- Upload Error (invalid file data)

## [3.0.0] - 2022-01-20
### Added
- Support Deepl Free Api (https://support.deepl.com/hc/en/articles/360021200939-DeepL-API-Free)
Expand Down
3 changes: 1 addition & 2 deletions src/Handler/DeeplFileSubmissionRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public function getBody(): StreamInterface
return $this->multipartStreamBuilder
->setBoundary('boundary')
->addResource('auth_key', $this->authKey)
->addResource('file', $this->fileTranslation->getFileContent())
->addResource('filename', $this->fileTranslation->getFileName())
->addResource('file', $this->fileTranslation->getFileContent(), ['filename' => $this->fileTranslation->getFileName()])
->addResource('source_lang', $this->fileTranslation->getSourceLang())
->addResource('target_lang', $this->fileTranslation->getTargetLang())
->build();
Expand Down
5 changes: 2 additions & 3 deletions tests/Handler/DeeplFileSubmissionRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ public function testGetBodyCanReturnFilteredArray(): void
->method('setBoundary')
->with('boundary')
->willReturn($this->streamBuilder);
$this->streamBuilder->expects($this->exactly(5))
$this->streamBuilder->expects($this->exactly(4))
->method('addResource')
->withConsecutive(
['auth_key', 'some key'],
['file', 'file content'],
['filename', 'file name'],
['file', 'file content', ['filename' => 'file name']],
['source_lang', 'source lang'],
['target_lang', 'target lang']
)
Expand Down