Skip to content

Commit

Permalink
Add dom check before setting default useragent
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanmarks committed Feb 1, 2016
1 parent 691ee93 commit 7818062
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import {
summarizeAlterations
} from './utils';

const canUseDOM = !!(
typeof window !== 'undefined' &&
window.document && //eslint-disable-line
window.document.createElement //eslint-disable-line
);

/**
* @module cbioportal-api-client
*/
Expand Down Expand Up @@ -42,7 +48,7 @@ import {
*/
export default function CbioPortal ({ requestOpts = false } = {}) {
return Object.assign(Object.create(cbioPortal), {
requestOpts: _defaults(requestOpts, {
requestOpts: _defaults(requestOpts, canUseDOM ? {} : {
headers: {
'User-Agent': 'cbioportal-api-client.js/1.0.0'
}
Expand Down

0 comments on commit 7818062

Please sign in to comment.