nestjs / terminus

Terminus module for Nest framework (node.js) :robot:

Home Page:https://nestjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HttpHealthIndicator.responseCheck does not work when status is >400

BrunnerLivio opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Given the following example:

this.http.responseCheck(
          'nestjs-docs',
          'http://localhost:3000/api/',
          (res) => {
            return res.status === 403;
          },
        ),

It will return the following result

{
    "status": "error",
    "info": {},
    "error": {
        "nestjs-docs": {
            "status": "down",
            "message": "Request failed with status code 403",
            "statusCode": 403,
            "statusText": "Forbidden"
        }
    },
    "details": {
        "nestjs-docs": {
            "status": "down",
            "message": "Request failed with status code 403",
            "statusCode": 403,
            "statusText": "Forbidden"
        }
    }
}

Even if the request itself to localhost:3000/api returns 403

Minimum reproduction code

this.http.responseCheck(
          'nestjs-docs',
          'http://localhost:3000/api/',
          (res) => {
            return res.status === 403;
          },
        ),

Steps to reproduce

No response

Expected behavior

It should at least handle the third paramter callback

Package version

9.0.0

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Released with 9.1.0 🎉