Skip to content

Commit 9cfbfd6

Browse files
committed
Unrelated fix for letters API
1 parent b91149b commit 9cfbfd6

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

lib/Api/LettersApi.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,17 +340,21 @@ public function createWithHttpInfo($letter_editable, $idempotency_key = null, $f
340340
$options = $this->createHttpClientOption();
341341
$requestError = null;
342342
try {
343-
$response = $this->client->request(
344-
'POST',
345-
$request->getUri()->__toString(),
346-
[
347-
'multipart' => [[
348-
'name' => 'file',
349-
'contents' => Utils::tryFopen($file, 'r')
350-
]],
351-
'auth' => $options['auth']
352-
]
353-
);
343+
if ($file !== null) {
344+
$response = $this->client->request(
345+
'POST',
346+
$request->getUri()->__toString(),
347+
[
348+
'multipart' => [[
349+
'name' => 'file',
350+
'contents' => Utils::tryFopen($file, 'r')
351+
]],
352+
'auth' => $options['auth']
353+
]
354+
);
355+
} else {
356+
$response = $this->client->send($request, $options);
357+
}
354358
} catch (RequestException $e) {
355359
$errorBody = json_decode($e->getResponse()->getBody()->getContents())->error;
356360
$requestError = new LobError();

0 commit comments

Comments
 (0)