Releases: micene09/scarlett
v1.3.0
💎 New responseType
behaviours
Now it can be defined even as:
- A sync method returning a
HttpResponseFormatType
(request: IRequest, fetchResponse: Response | null) => HttpResponseFormatType
- An async method resolving a
HttpResponseFormatType
(request: IRequest, fetchResponse: Response | null) => Promise<HttpResponseFormatType>
Check out the doc to see more details.
⚙️ Internal updates
Updated internal dependencies and typings.
v1.2.1
v1.2.0
💎 New body parsing behavior
The responseType
option now supports the value null
or undefined
.
Using these falsey values prevents the internal body parsing.
The responseType
default value changed from json
to undefined
.
Having a default like json
forces the body parsing for every response, even when is not needed, raising the risks of error due to possible format mismatches between the expected and the received response type.
Avoiding the body parsing is the cleanest default behavior, considering that every option, included the responseType
, can be overridden globally (via constructor or using this.options
API) or locally (on the request's options).
v1.1.2
v1.1.0
v1.0.1
v1.0.0
🎉 It's finally here!
After months of testing, bugs fixing, stressed usage in large business web apps/portals...here we are, the first and stable release.
💎 Improvements
- Improved documentation
RestError
's related:- Updated constructor
- Implemented
code
property, used for internal, non-REST calls related, error codes - The
code
property can be used asthrowExcluding
filter, so you can exclude errors like timeout or body parsing
- Removed the
onFilterMatch
option onIResponseFilter
, due to the presence ofthrowFilter
property on the response object. - A
throwExcluding
filter can be defined even as a sync/async method returningtrue
to prevent the error
💪 Bugfixes
- Fixed error thrown on timeout
- Fixed error thrown on abort
- Fixed
RestError
messages, always keeping care about the error reason (native, rest or internal)
⚙️ Internals
- Updated dependencies
- Fixed
jest
test suite and debugging - Switched to GitHub Actions
- Updated and simplified
tsconfig.json
structure - Updated typescript build target to
ES2021
v1.0.0-rc3
Bugfixes
- Added missing
response.error.fetchResponse
v1.0.0-rc2
Improvement
- A client library shouldn't go into the matter of the response HTTP status code, so now it will be avoided.
v1.0.0-rc-1
🤙 Improvements
- The timeout error now will set the response HTTP status code as 408 (
RequestTimeout
) - Now using the HTTP status code 511 (
ClientErrors
) when the client fails on response body parsing - Updated
onError
, added the entireresponse
as second parameter - Simplified
RestError
class, avoiding circular references and more optimizations (see breaking changes) - Breaking Changes
⚠️ - Removed
response.options
(was already present inresponse.request.options
) - Now setting
response.data
asnull
when aRestError
occurs (response.error.data
remains set) - The
RestError
now has a more rest related constructor:(statusCode: number, message: string)
- Removed the extra template on
RestError<TError, TResponse>
, now justRestError<TError>
- Removed console methods from
RestError
- Removed
👍 Bugfixes
- Fixed empty
response.headers
⚙️ Internals
- Yarn v3
- Updated build dependencies
- Updated doc