Skip to content

Add tests for NodeClientRequest's "setEncoding" on the mocked response #179

@kettanaito

Description

@kettanaito

The res.setEncoding() must be respected when returning the mocked response.

const req = http.get('...')

req.on('response', (res) => {
  res.setEncoding('base64')
  res.on('data', collectChunks)
  res.on('end', () => {
    expect(collectedChunks).toEqual(base64string)
  })
})

This must be added for each BufferEncoding:

type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions