Skip to content

Commit

Permalink
fix: Small improvements in reselience of http requests to Cognos. Sup…
Browse files Browse the repository at this point in the history
…port of Redirects for example.
  • Loading branch information
batje committed Aug 2, 2018
1 parent 5d458c8 commit eb20164
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/CognosRequest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from 'axios';
import { Utils } from './Utils';

import axiosCookieJarSupport from 'axios-cookiejar-support';

// I dont think we should need this by now
Expand Down Expand Up @@ -46,7 +45,15 @@ class CognosRequest {
var me = this;
var cookieJar = false;
var firstheaders = {};
this.axios = axios.create({});
this.axios = axios.create({
timeout: 60000,

//follow up to 10 HTTP 3xx redirects
maxRedirects: 10,

//cap the maximum content length we'll accept to 50MBs, just in case
maxContentLength: 50 * 1000 * 1000
});
if (Utils.isNode()) {
axiosCookieJarSupport(this.axios);
var cookieJar = new tough.CookieJar();
Expand Down Expand Up @@ -113,6 +120,7 @@ class CognosRequest {
typeof err.response === 'undefined' ||
err.response.status !== 441
) {
me.log('Unexpected Error in initialise', err);
throw err.message;
}
me.log('Expected Error in initialise');
Expand Down

0 comments on commit eb20164

Please sign in to comment.