Fix Hurst fetch URL to use full API_BASE_URL and ensure endpoint returns JSON for all query params
This commit is contained in:
26
node_modules/union/examples/simple/middleware/gzip-decode.js
generated
vendored
Normal file
26
node_modules/union/examples/simple/middleware/gzip-decode.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
var spawn = require('child_process').spawn,
|
||||
util = require('util'),
|
||||
RequestStream = require('../../lib').RequestStream;
|
||||
|
||||
var GzipDecode = module.exports = function GzipDecoder(options) {
|
||||
RequestStream.call(this, options);
|
||||
|
||||
this.on('pipe', this.decode);
|
||||
}
|
||||
|
||||
util.inherits(GzipDecode, RequestStream);
|
||||
|
||||
GzipDecode.prototype.decode = function (source) {
|
||||
this.decoder = spawn('gunzip');
|
||||
this.decoder.stdout.on('data', this._onGunzipData.bind(this));
|
||||
this.decoder.stdout.on('end', this._onGunzipEnd.bind(this));
|
||||
source.pipe(this.decoder);
|
||||
}
|
||||
|
||||
GzipDecoderStack.prototype._onGunzipData = function (chunk) {
|
||||
this.emit('data', chunk);
|
||||
}
|
||||
|
||||
GzipDecoderStack.prototype._onGunzipEnd = function () {
|
||||
this.emit('end');
|
||||
}
|
||||
Reference in New Issue
Block a user