Angular HTTP: Status -1 and CORS

前端 未结 2 2004
鱼传尺愫
鱼传尺愫 2020-12-11 20:02

In our angular application sometimes we get http status -1 returned to us. The status -1 happens on a popup that is closed, so the user isn\'t affected by it, just our logs.

2条回答
  •  温柔的废话
    2020-12-11 20:25

    When the request is aborted or timed-out, the request lands as an error with status -1.

    Taken from the official docs:

    Also, status codes less than -1 are normalized to zero. -1 usually means the request was aborted, e.g. using a config.timeout.

    timeout – {number|Promise} – timeout in milliseconds, or promise that should abort the request when resolved.

提交回复
热议问题