Skip to content

Commit

Permalink
Merge pull request #14 from tresbach/main
Browse files Browse the repository at this point in the history
Update README fixing syntax error
  • Loading branch information
Thavarshan authored Mar 8, 2025
2 parents a967aba + 650e82f commit 003d450
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async(fn () => fetch('https://example.com', [
'body' => json_encode(['key' => 'value']),
]))
->then(fn (ResponseInterface $response) => $data = $response->json()) // Success handler
->catch(fn (\Throwable $e) => echo "Error: " . $e->getMessage()); // Error handler
->catch(fn (\Throwable $e) => print "Error: " . $e->getMessage()); // Error handler

// The async operation is managed with start, pause, resume, and cancel controls
$task = async(fn () => fetch('https://example.com', [
Expand Down Expand Up @@ -193,7 +193,7 @@ async(fn () => fetch('https://example.com', [
'body' => json_encode(['key' => 'value']),
]))
->then(fn (ResponseInterface $response) => $data = $response->json()) // Success handler
->catch(fn (\Throwable $e) => echo "Error: " . $e->getMessage()); // Error handler
->catch(fn (\Throwable $e) => print "Error: " . $e->getMessage()); // Error handler
```

---
Expand Down Expand Up @@ -244,7 +244,7 @@ async(fn () => fetch()
->withToken('fake-bearer-auth-token')
->post('/posts'))
->then(fn (ResponseInterface $response) => $data = $response->json()) // Success handler
->catch(fn (\Throwable $e) => echo "Error: " . $e->getMessage()); // Error handler
->catch(fn (\Throwable $e) => print "Error: " . $e->getMessage()); // Error handler
```

---
Expand Down Expand Up @@ -282,7 +282,7 @@ async(fn () => ClientHandler::handle('POST', 'https://example.com', [
'body' => json_encode(['key' => 'value']),
]))
->then(fn ($response) => $data = $response->json())
->catch(fn ($e) => echo "Error: " . $e->getMessage());
->catch(fn ($e) => print "Error: " . $e->getMessage());
```

---
Expand Down Expand Up @@ -327,7 +327,7 @@ if ($response->ok()) {

$response = async(fn () => fetch('https://nonexistent-url.com'))
->then(fn ($response) => $response->json())
->catch(fn ($e) => echo "Error: " . $e->getMessage());
->catch(fn ($e) => print "Error: " . $e->getMessage());

echo $response;
```
Expand Down

0 comments on commit 003d450

Please sign in to comment.