Skip to content

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rchipka committed Oct 6, 2016
1 parent c7e1e0f commit 21a5e2f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Osmosis(url, params) {
* @property {bool} keep_data - Keep raw HTTP data in
context.response.data
* @property {bool} timeout - HTTP request timeout
* @property {bool} tries - HTTP request retries
* @property {bool} tries - HTTP request attempts
* @property {bool} user_agent - HTTP user agent
* @memberof Osmosis
* @instance
Expand Down Expand Up @@ -202,8 +202,8 @@ Osmosis.prototype.request = function (url, opts, callback, tries) {
}
}

if (err !== null && tries < opts.tries) {
self.queueRequest(url, opts, callback, tries + 1);
if (err !== null && ++tries < opts.tries) {
self.queueRequest(url, opts, callback, tries);

if (self.opts.log === true) {
self.command.error(err + ', retrying ' +
Expand Down
6 changes: 5 additions & 1 deletion lib/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ form.getParams = function (node) {
name = name.substr(0, name.length - 2);
}

if (type) {
type = type.toLowerCase();
}

switch (nodeName) {
case 'select':
input = input.get('option[selected]') ||
Expand All @@ -117,7 +121,7 @@ form.getParams = function (node) {
value = input.textContent;
break;
case 'input':
switch (input.getAttribute('type').toLowerCase()) {
switch (type) {
case 'radio':
case 'checkbox':
if (!input.hasAttribute('checked')) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osmosis",
"version": "1.1.0",
"version": "1.1.1",
"description": "Web scraper for NodeJS",
"keywords": [
"web",
Expand All @@ -20,8 +20,8 @@
"email": "[email protected]"
},
"dependencies": {
"needle": "1.0.0",
"libxmljs-dom": "0.0.7"
"needle": "1.1.2",
"libxmljs-dom": "0.0.8"
},
"devDependencies": {
"jscs": ">=3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions test/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports.error_404 = function (assert) {
.config('ignore_http_errors', false)
.config('tries', tries)
.error(function (msg) {
if (msg.indexOf('404') > -1 && msg.indexOf('try') > -1) {
if (msg.indexOf('404') > -1) {
tried++;
}
})
Expand Down Expand Up @@ -92,7 +92,7 @@ module.exports.error_parse = function (assert) {
osmosis.get(url + '/error-parse')
.config('tries', tries)
.error(function (msg) {
if (msg.indexOf('empty') > -1 && msg.indexOf('try') > -1) {
if (msg.indexOf('empty') > -1) {
tries--;
}
})
Expand Down

0 comments on commit 21a5e2f

Please sign in to comment.