Skip to content

Releases: seek-oss/koala

v7.0.4

01 Apr 23:29
a485dc4
Compare
Choose a tag to compare

7.0.4 (2024-04-01)

Bug Fixes

v7.1.0-beta.1

16 Oct 03:23
cd797b6
Compare
Choose a tag to compare
v7.1.0-beta.1 Pre-release
Pre-release

7.1.0-beta.1 (2023-10-16)

Features

  • RequestLogging: Expose getStore (cd797b6)

v7.0.3

28 Aug 22:44
760c9bd
Compare
Choose a tag to compare

7.0.3 (2023-08-28)

Bug Fixes

v7.0.2

28 Aug 22:29
97847d7
Compare
Choose a tag to compare

7.0.2 (2023-08-28)

Bug Fixes

v7.0.1

28 Aug 02:56
7f8ad57
Compare
Choose a tag to compare

7.0.1 (2023-08-28)

Bug Fixes

  • ErrorMiddleware: Support multiple http-errors versions (#200) (7f8ad57)

v7.0.0

25 Aug 02:52
591fb75
Compare
Choose a tag to compare

7.0.0 (2023-08-25)

BREAKING CHANGES

ErrorMiddleware: Only respect certain err.statuses (#199) (591fb75)

Some HTTP clients throw errors with a status property to indicate the status code of the HTTP response. If such an error was not handled by a middleware or controller further up the chain, ErrorMiddleware.handle would previously pick up the error and reflect its status code back to your client.

Most of the time, this is not what you want. For example, if your server depends on an upstream service-to-service endpoint and it starts to respond with HTTP 401s, that may imply that your server is not appropriately authenticated and is at fault, and should default to a HTTP 500. This is now the default behaviour of ErrorMiddleware.handle.

If you want to throw an error that ErrorMiddleware.handle will pick up to modify your response status code, you are now limited to three options:

  1. Use http-errors

    import createError from 'http-errors';
    
    const controller = () => {
      throw new createError.ImATeapot();
    };
  2. Use ctx.throw

    const controller = (ctx) => {
      ctx.throw(418, 'Badness!');
    };
  3. Include isJsonResponse and status properties on your error

    class MyCustomError extends Error {
      constructor(
        message: string,
        public isJsonResponse: boolean,
        public status: number,
      ) {
        super(message);
    
        this.isJsonResponse = isJsonResponse;
        this.status = status;
      }
    }
    
    const controller = () => {
      throw new MyCustomError('Badness!', [secure], 418);
    };

v6.0.0

31 May 02:15
1db0bcb
Compare
Choose a tag to compare

6.0.0 (2022-05-31)

Features

BREAKING CHANGES

  • TracingHeaders: Koala has switched generation of V4 UUID request IDs from the third-party uuid module to the built-in node:crypto module. The minimum supported Node.js version is now 14.17.0.

v5.2.1

27 May 00:23
733cbd5
Compare
Choose a tag to compare

5.2.1 (2022-05-27)

Bug Fixes

  • RequestLogging.createContextStorage: Shallow copy context store for the mixin function (#155) (733cbd5)

v5.2.0

21 May 01:03
e4a98d4
Compare
Choose a tag to compare

5.2.0 (2022-05-21)

Features

  • RequestLogging: Add createContextStorage (#153) (e4a98d4)

v5.1.1

05 Apr 04:05
33035c6
Compare
Choose a tag to compare

5.1.1 (2022-04-05)

Bug Fixes