Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More eslint #1536

Merged
merged 4 commits into from Apr 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc
Expand Up @@ -34,6 +34,12 @@
// eslint can't handle this, so the check is disabled.
"key-spacing": 0,
// Allow shadowing vars in outer scope (needs discussion)
"no-shadow": 0
"no-shadow": 0,
// Use if () { }
// ^ space
"space-after-keywords": [2, "always"],
// Use if () { }
// ^ space
"space-before-blocks": [2, "always"]
}
}
2 changes: 1 addition & 1 deletion lib/helpers.js
Expand Up @@ -4,7 +4,7 @@ var jsonSafeStringify = require('json-stringify-safe')
, crypto = require('crypto')

function deferMethod() {
if(typeof setImmediate === 'undefined') {
if (typeof setImmediate === 'undefined') {
return process.nextTick
}

Expand Down
2 changes: 1 addition & 1 deletion lib/multipart.js
Expand Up @@ -31,7 +31,7 @@ Multipart.prototype.isChunked = function (options) {

if (!chunked) {
parts.forEach(function (part) {
if(typeof part.body === 'undefined') {
if (typeof part.body === 'undefined') {
throw new Error('Body attribute missing in multipart.')
}
if (isstream(part.body)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"browserify": "~5.9.1",
"browserify-istanbul": "~0.1.3",
"coveralls": "~2.11.2",
"eslint": "0.17.1",
"eslint": "0.18.0",
"function-bind": "~1.0.0",
"istanbul": "~0.3.2",
"karma": "~0.12.21",
Expand Down
20 changes: 11 additions & 9 deletions request.js
Expand Up @@ -415,7 +415,7 @@ Request.prototype.init = function (options) {
}

// If a string URI/URL was given, parse it into a URL object
if(typeof self.uri === 'string') {
if (typeof self.uri === 'string') {
self.uri = url.parse(self.uri)
}

Expand All @@ -425,7 +425,7 @@ Request.prototype.init = function (options) {
}

// Support Unix Sockets
if(self.uri.host === 'unix') {
if (self.uri.host === 'unix') {
// Get the socket & request paths from the URL
var unixParts = self.uri.path.split(':')
, host = unixParts[0]
Expand All @@ -443,7 +443,7 @@ Request.prototype.init = function (options) {
self.rejectUnauthorized = false
}

if(!self.hasOwnProperty('proxy')) {
if (!self.hasOwnProperty('proxy')) {
self.proxy = getProxyFromURI(self.uri)
}

Expand Down Expand Up @@ -579,12 +579,12 @@ Request.prototype.init = function (options) {
}

if (self.uri.auth && !self.hasHeader('authorization')) {
var uriAuthPieces = self.uri.auth.split(':').map(function(item){ return querystring.unescape(item) })
var uriAuthPieces = self.uri.auth.split(':').map(function(item) { return querystring.unescape(item) })
self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true)
}

if (!self.tunnel && self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization')) {
var proxyAuthPieces = self.proxy.auth.split(':').map(function(item){
var proxyAuthPieces = self.proxy.auth.split(':').map(function(item) {
return querystring.unescape(item)
})
var authHeader = 'Basic ' + toBase64(proxyAuthPieces.join(':'))
Expand Down Expand Up @@ -1210,17 +1210,19 @@ Request.prototype.onRequestResponse = function (response) {
if (self._json) {
try {
response.body = JSON.parse(response.body, self._jsonReviver)
} catch (e) {}
} catch (e) {
// empty
}
}
debug('emitting complete', self.uri.href)
if(typeof response.body === 'undefined' && !self._json) {
if (typeof response.body === 'undefined' && !self._json) {
response.body = self.encoding === null ? new Buffer(0) : ''
}
self.emit('complete', response, response.body)
})
}
//if no callback
else{
else {
self.on('end', function () {
if (self._aborted) {
debug('aborted', self.uri.href)
Expand Down Expand Up @@ -1299,7 +1301,7 @@ Request.prototype.qs = function (q, clobber) {
base[i] = q[i]
}

if (self.qsLib.stringify(base, self.qsStringifyOptions) === ''){
if (self.qsLib.stringify(base, self.qsStringifyOptions) === '') {
return self
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test-baseUrl.js
Expand Up @@ -6,7 +6,7 @@ var http = require('http')
, url = require('url')

var s = http.createServer(function(req, res) {
if(req.url === '/redirect/') {
if (req.url === '/redirect/') {
res.writeHead(302, {
location : '/'
})
Expand Down