Skip to content

Releases: micene09/scarlett

v1.3.0

17 Jan 22:10
Compare
Choose a tag to compare

💎 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

11 Jan 23:55
Compare
Choose a tag to compare
  • Fixed bug: ignoring the override of responseType option having undefined or null values.
  • Fixed internal mergeValue() error on null based options overrides.

v1.2.0

11 Jan 10:17
Compare
Choose a tag to compare

💎 New body parsing behavior
The responseType option now supports the value null or undefined.
Using these falsey values prevents the internal body parsing.

⚠️ Breaking change
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

22 Dec 17:14
Compare
Choose a tag to compare

Updated IResponseFilterHook(Async) definition, to fix the throwExcluding type inference when used as sync/async method.

v1.1.0

21 Dec 14:30
Compare
Choose a tag to compare

Updated the onRequest global handler definition, now supporting the Promise return type.

If the return value is a Promise's instance, the request will await for it before starting.

v1.0.1

16 Dec 11:53
Compare
Choose a tag to compare

Added ES6-CommonJs build target.

v1.0.0

09 Dec 08:54
Compare
Choose a tag to compare

🎉 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 as throwExcluding filter, so you can exclude errors like timeout or body parsing
  • Removed the onFilterMatch option on IResponseFilter, due to the presence of throwFilter property on the response object.
  • A throwExcluding filter can be defined even as a sync/async method returning true 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

18 Oct 08:29
Compare
Choose a tag to compare

Bugfixes

  • Added missing response.error.fetchResponse

v1.0.0-rc2

18 Oct 07:54
Compare
Choose a tag to compare

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

17 Oct 19:36
Compare
Choose a tag to compare

🤙 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 entire response as second parameter
  • Simplified RestError class, avoiding circular references and more optimizations (see breaking changes)
  • Breaking Changes ⚠️
    • Removed response.options (was already present in response.request.options)
    • Now setting response.data as null when a RestError 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 just RestError<TError>
    • Removed console methods from RestError

👍 Bugfixes

  • Fixed empty response.headers

⚙️ Internals

  • Yarn v3
  • Updated build dependencies
  • Updated doc