summaryrefslogtreecommitdiff
path: root/node_modules/snekfetch/src/node/transports/ResponseStream.js
blob: 1d401014f73e7aa7bb8db940ea4779a106284dd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const Stream = require('stream');

class ResponseStream extends Stream.Readable {
  constructor() {
    super();
    this.statusCode = 200;
    this.status = 'OK';
  }

  error(code, message) {
    this.statusCode = code;
    this.status = message;
    return this;
  }

  on(event, handler) {
    if (['end', 'open'].includes(event))
      handler();
  }

  _read() {} // eslint-disable-line no-empty-function
}

module.exports = ResponseStream;