Skip to content

Conversation

@pakerfeldt
Copy link

@pakerfeldt pakerfeldt commented May 6, 2025

What happened

PR #74 added a type‑safety guard to src/nodes/Request.ts:

const _send = (Result: UnifiResponse) => {
    self.send({
        payload: Result,
        inputMsg: msg,
    })
}
if (!Buffer.isBuffer(data) && typeof data !== 'string') {
    _send(data)
}

The guard works for JSON endpoints, but it silently drops every UniFi endpoint that returns raw bytes or plain text — most notably the Protect /snapshot thumbnails that are requested with responseType: 'arraybuffer'.
Since those thumbnails are delivered as Node Buffers, downstream flows never see them.

What this PR does

  • Restores the pre‑1.1 behaviour for binary and text payloads.
  • Keeps the stricter UnifiResponse typing for all JSON endpoints.
  • Collateral cleanup: Removes the console.log (moving the type printed into another debug log)

fixes #90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant