Skip to content

req.write should throw error where chunk is undefined #458

@mikicho

Description

@mikicho

https://github.com/mswjs/interceptors/blob/main/src/interceptors/ClientRequest/NodeClientRequest.ts#L101

chunk must not be undefined and throw:

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined

I can open a PR, but because you ignored this case positively, I want to ensure I don't miss something.

About the solution, we can either:

  1. call to super.write() and let Node emit the error
  2. Return a custom error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions