Current section
14 Versions
Jump to
Current section
14 Versions
Compare versions
6
files changed
+19
additions
-13
deletions
| @@ -10,6 +10,11 @@ gleam add gleam_fetch@1 gleam_http | |
| 10 10 | ``` |
| 11 11 | |
| 12 12 | ```gleam |
| 13 | + import gleam/fetch |
| 14 | + import gleam/http/request |
| 15 | + import gleam/http/response |
| 16 | + import gleam/javascript/promise |
| 17 | + |
| 13 18 | pub fn main() { |
| 14 19 | let assert Ok(req) = request.to("https://example.com") |
| @@ -1,5 +1,5 @@ | |
| 1 1 | name = "gleam_fetch" |
| 2 | - version = "1.3.0" |
| 2 | + version = "1.3.1" |
| 3 3 | licences = ["Apache-2.0"] |
| 4 4 | description = "Make HTTP requests in Gleam JavaScript with Fetch" |
| 5 5 | target = "javascript" |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {<<"name">>, <<"gleam_fetch">>}. |
| 2 2 | {<<"app">>, <<"gleam_fetch">>}. |
| 3 | - {<<"version">>, <<"1.3.0">>}. |
| 3 | + {<<"version">>, <<"1.3.1">>}. |
| 4 4 | {<<"description">>, <<"Make HTTP requests in Gleam JavaScript with Fetch"/utf8>>}. |
| 5 5 | {<<"licenses">>, [<<"Apache-2.0">>]}. |
| 6 6 | {<<"build_tools">>, [<<"gleam">>]}. |
| @@ -10,6 +10,11 @@ | |
| 10 10 | {<<"Repository">>, <<"https://github.com/gleam-lang/fetch">>} |
| 11 11 | ]}. |
| 12 12 | {<<"requirements">>, [ |
| 13 | + {<<"gleam_stdlib">>, [ |
| 14 | + {<<"app">>, <<"gleam_stdlib">>}, |
| 15 | + {<<"optional">>, false}, |
| 16 | + {<<"requirement">>, <<">= 0.32.0 and < 2.0.0">>} |
| 17 | + ]}, |
| 13 18 | {<<"gleam_http">>, [ |
| 14 19 | {<<"app">>, <<"gleam_http">>}, |
| 15 20 | {<<"optional">>, false}, |
| @@ -19,11 +24,6 @@ | |
| 19 24 | {<<"app">>, <<"gleam_javascript">>}, |
| 20 25 | {<<"optional">>, false}, |
| 21 26 | {<<"requirement">>, <<">= 0.3.0 and < 2.0.0">>} |
| 22 | - ]}, |
| 23 | - {<<"gleam_stdlib">>, [ |
| 24 | - {<<"app">>, <<"gleam_stdlib">>}, |
| 25 | - {<<"optional">>, false}, |
| 26 | - {<<"requirement">>, <<">= 0.32.0 and < 2.0.0">>} |
| 27 27 | ]} |
| 28 28 | ]}. |
| 29 29 | {<<"files">>, [ |
| @@ -11,7 +11,7 @@ import gleam/javascript/promise.{type Promise} | |
| 11 11 | /// Take note that a 500 response is not considered as an error: it is a |
| 12 12 | /// successful request, which indicates the server triggers an error. |
| 13 13 | pub type FetchError { |
| 14 | - /// A network error occured, maybe because user lost network connection, |
| 14 | + /// A network error occurred, maybe because user lost network connection, |
| 15 15 | /// because the network took to long to answer, or because the |
| 16 16 | /// server timed out. |
| 17 17 | NetworkError(String) |
| @@ -127,7 +127,7 @@ pub fn send_bits( | |
| 127 127 | /// [`Request`](https://developer.mozilla.org/docs/Web/API/Request), where |
| 128 128 | /// `body` is a string. |
| 129 129 | /// |
| 130 | - /// Can be used in conjuction with `raw_send`, or when you need to reuse your |
| 130 | + /// Can be used in conjunction with `raw_send`, or when you need to reuse your |
| 131 131 | /// `Request` in JavaScript FFI. |
| 132 132 | /// |
| 133 133 | /// ```gleam |
| @@ -144,7 +144,7 @@ pub fn to_fetch_request(a: Request(String)) -> FetchRequest | |
| 144 144 | /// [`Request`](https://developer.mozilla.org/docs/Web/API/Request), where |
| 145 145 | /// `body` is a JavaScript `FormData` object. |
| 146 146 | /// |
| 147 | - /// Can be used in conjuction with `raw_send`, or when you need to reuse your |
| 147 | + /// Can be used in conjunction with `raw_send`, or when you need to reuse your |
| 148 148 | /// `Request` in JavaScript FFI. |
| 149 149 | /// |
| 150 150 | /// ```gleam |
| @@ -165,7 +165,7 @@ pub fn form_data_to_fetch_request(a: Request(FormData)) -> FetchRequest | |
| 165 165 | /// [`Request`](https://developer.mozilla.org/docs/Web/API/Request), where |
| 166 166 | /// `body` is a JavaScript `UInt8Array` object. |
| 167 167 | /// |
| 168 | - /// Can be used in conjuction with `raw_send`, or when you need to reuse your |
| 168 | + /// Can be used in conjunction with `raw_send`, or when you need to reuse your |
| 169 169 | /// `Request` in JavaScript FFI. |
| 170 170 | /// |
| 171 171 | /// ```gleam |
| @@ -15,7 +15,7 @@ import gleam/javascript/promise.{type Promise} | |
| 15 15 | |
| 16 16 | /// Form data represents form fields and their values, as a set of key/value |
| 17 17 | /// pairs. Keys are always strings, while values can be either strings or blob. |
| 18 | - /// Form data can be used in conjuction with `fetch`, and uses the same format a |
| 18 | + /// Form data can be used in conjunction with `fetch`, and uses the same format a |
| 19 19 | /// form would use with the encoding type were set to `"multipart/form-data"`. |
| 20 20 | /// Form data can have multiple values for a same key, and those values can be |
| 21 21 | /// of any type (string or blob). |
Loading more files…