@swan-io/request
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -34,3 +34,3 @@ import { Future, Option, Result } from "@swan-io/boxed"; | ||
}; | ||
type Response<T> = { | ||
export type Response<T> = { | ||
status: number; | ||
@@ -37,0 +37,0 @@ ok: boolean; |
@@ -0,4 +1,9 @@ | ||
# 1.0.1 | ||
## Changes | ||
- Expose `Response` type | ||
# 1.0.0 | ||
Initial version |
{ | ||
"name": "@swan-io/request", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Wrapper for XMLHttpRequest with better data-structures", | ||
@@ -5,0 +5,0 @@ "main": "dist/Request.js", |
@@ -91,7 +91,18 @@ <img width="108" alt="@swan-io/request logo" src="https://github.com/swan-io/request/blob/main/logo.svg?raw=true"> | ||
#### emptyToError | ||
#### Return value | ||
Returns a `Future<Result<Response<T>, NetworkError | TimeoutError>>`, where `Response<T>` has the following properties: | ||
- `status`: `number` | ||
- `ok`: `boolean` | ||
- `response`: `Option<T>` | ||
- `xhr`: `XMLHttpRequest` | ||
`T` is the type associated with the `responseType` provided in the `config` object. | ||
### emptyToError | ||
Helper to use with `mapOkToResult` to consider empty response as an error. | ||
#### badStatusToError | ||
### badStatusToError | ||
@@ -98,0 +109,0 @@ Helper to use with `mapOkToResult` to consider a status outside of the 200-299 range as an error. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27831
111