2024-06-10 17:16:33 +00:00
|
|
|
# purescript-ezfetch
|
|
|
|
High-level bindings to the native `fetch` API
|
|
|
|
|
|
|
|
## `Effect.Aff.HTTP`
|
|
|
|
The main entry point is `Effect.Aff.HTTP.fetch`:
|
|
|
|
|
|
|
|
```purescript
|
|
|
|
fetch <method> <url> <options>
|
|
|
|
```
|
|
|
|
|
|
|
|
* `<method>` is `Effect.Aff.HTTP.Request.Method`:
|
2024-06-10 17:17:41 +00:00
|
|
|
<!-- language: purescript -->
|
2024-06-10 17:16:33 +00:00
|
|
|
data Method
|
|
|
|
= GET
|
|
|
|
| PUT
|
|
|
|
| POST
|
|
|
|
| DELETE
|
|
|
|
| PATCH
|
|
|
|
| HEAD
|
|
|
|
* `<url>` is `Data.URL.URL` (from [`url-immutable`](https://pursuit.purescript.org/packages/purescript-url-immutable/))
|
|
|
|
* `<options>` is a partial record of:
|
2024-06-10 17:17:41 +00:00
|
|
|
<!-- language: purescript -->
|
2024-06-10 17:16:33 +00:00
|
|
|
type OptionalFields =
|
|
|
|
( body :: Body
|
|
|
|
, headers :: Headers
|
|
|
|
, credentials :: Credentials
|
|
|
|
)
|