Back to Browse

Goodbye Fetch, Hello Effect-TS' HttpClient

8.7K views
May 12, 2025
39:50

👉 Enroll to Practical Effect here: https://lucasbarake.com/ Buy me a coffee! https://buymeacoffee.com/lucasbarake 00:00:00 Limitations of Fetch & Existing HTTP Libraries 00:01:58 Introducing Effect as a Comprehensive Solution 00:02:43 Required Effect Packages for HTTP Client 00:03:20 Basic Setup: Effect Program & HttpClient Tag 00:04:28 Making a GET Request & Effect's Laziness 00:06:01 Basic Error Handling with `catchTag` 00:06:43 Handling Response Body: `response.json` & Schema Validation 00:09:01 Composing Response Handling: `HttpClientResponse.schemaBodyJson` 00:10:21 Creating Custom Response Combinators (Data-Last) 00:11:31 Making a POST Request & Understanding `Http.Body` 00:12:51 Effectful vs. Unsafe Body Creation (`HttpBody.json`) 00:14:13 Composing Requests with `HttpClientRequest` 00:16:03 Benefits of Composable Requests for Reusability 00:17:41 Executing Pre-Composed Requests with `HttpClient.execute` 00:18:24 Client: Composing the HTTP Client Itself: `mapRequest` 00:20:05 Client: Asynchronous Pre-processing with `mapRequestEffect` 00:20:55 Client: `mapRequestInput` vs. `mapRequest` (Prepend vs. Append) 00:21:52 Client: Post-processing Responses with `transformResponse` 00:22:46 Client: Implementing Retry Logic via `transformResponse` 00:23:18 Client: Built-in Retries: `HttpClient.retryTransient` 00:24:17 Advanced Error Remapping: Cognito Example Setup 00:25:32 Cognito Example: Defining Tagged Errors & Client Transform 00:27:24 Creating a Reusable Tagged Client Service 00:29:13 Request Cancellation & Timeouts with `Effect.timeout` 00:30:05 Adding Timeout Policy Directly to the Client 00:30:28 Providing Concrete HTTP Client Implementations (Fetch, Node, XHR) 00:33:18 Filtering HTTP Status Codes: `filterStatusOk` 00:34:09 Implementing Custom "Retry-After" Policy with `Schedule` 00:37:45 Structuring a Client with Multiple Retry Strategies 00:39:35 Conclusion

Download

0 formats

No download links available.

Goodbye Fetch, Hello Effect-TS' HttpClient | NatokHD