Skip to content

Commit

Permalink
Fix: https.STATUS_CODE doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewaite committed Jun 19, 2017
1 parent d247312 commit 30f5d17
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var chalk, fs, gutil, httpsClient, path, paths, request, sprintf, through, util,
async, mkdirp;
async, mkdirp, httpClient;

gutil = require('gulp-util');
through = require('through2');
Expand All @@ -13,7 +13,8 @@ fs = require('fs');
paths = require('./libs/paths.js');
httpsClient = require('https');
async = require('async');
mkdirp = require('mkdirp');
mkdirp = require('mkdirp'),
httpClient = require('http');

module.exports = {
createClient: function (options) {
Expand All @@ -36,7 +37,7 @@ module.exports = {
results += data.toString();
} else {
req.emit('error', new Error(res.statusCode + ': ' +
httpsClient.STATUS_CODES[res.statusCode] + ' reaching the project'));
httpClient.STATUS_CODES[res.statusCode] + ' reaching the project'));
}
});
res.on('end', function () {
Expand Down Expand Up @@ -75,7 +76,7 @@ module.exports = {
} else {
req.emit('error', new Error(res.statusCode +
'in resourceAttributes(): ' +
httpsClient.STATUS_CODES[res.statusCode]));
httpClient.STATUS_CODES[res.statusCode]));
}
} else {
attrs += data.toString('utf8');
Expand Down Expand Up @@ -166,7 +167,7 @@ module.exports = {
languages += data.toString('utf8');
} else {
res.emit('error', new Error(res.statusCode + ' in languages(): ' +
httpsClient.STATUS_CODES[res.statusCode]));
httpClient.STATUS_CODES[res.statusCode]));
}
});
res.on('error', function (err) {
Expand Down Expand Up @@ -321,7 +322,7 @@ module.exports = {
msg += chalk.red('✘ ');
msg += chalk.white('Error creating new resource ');
msg += chalk.magenta(path.basename(file.path)) + ': ';
msg += chalk.white(httpsClient.STATUS_CODES[res2.statusCode]);
msg += chalk.white(httpClient.STATUS_CODES[res2.statusCode]);

req2.emit('Error:', new gutil.PluginError({
plugin: 'gulp-transifex',
Expand All @@ -341,7 +342,7 @@ module.exports = {
} else {
msg += chalk.red('✘ ');
msg += chalk.blue('Error: ' +
httpsClient.STATUS_CODES[res.statusCode]);
httpClient.STATUS_CODES[res.statusCode]);
msg += chalk.magenta(' ' +
path.basename(file.path));

Expand Down Expand Up @@ -461,7 +462,7 @@ module.exports = {
msg += chalk.red('✘ ');
msg += chalk.white('Error creating new resource ');
msg += chalk.magenta(path.basename(file.path)) + ': ';
msg += chalk.white(httpsClient.STATUS_CODES[res.statusCode]);
msg += chalk.white(httpClient.STATUS_CODES[res.statusCode]);
buffer.emit('', new gutil.PluginError({
plugin: 'gulp-transifex',
message: msg,
Expand Down Expand Up @@ -575,7 +576,7 @@ module.exports = {
res.emit('error', new gutil.PluginError({
plugin: 'gulp-transifex',
message: res.statusCode + 'in pullResource()[data]: ' +
httpsClient.STATUS_CODES[res.statusCode]
httpClient.STATUS_CODES[res.statusCode]
}));
}
}
Expand All @@ -602,7 +603,7 @@ module.exports = {
plugin: 'gulp-transifex',
message: res.statusCode +
' in pullResource()[end]: ' +
httpsClient.STATUS_CODES[res.statusCode]
httpClient.STATUS_CODES[res.statusCode]
}));
output.end();
}
Expand Down

0 comments on commit 30f5d17

Please sign in to comment.