Permalink
Browse files

fix(rest): fix handling of XML data in node

  • Loading branch information...
RangerRick committed Jul 21, 2017
1 parent e461831 commit 70fd445e5a23f81c21bdb6d6291460ef2aac03ec
Showing with 34 additions and 2 deletions.
  1. +2 −1 package.json
  2. +18 −0 src/rest/AbstractHTTP.ts
  3. +11 −0 typings/index.d.ts
  4. +2 −0 webpack.config.js
  5. +1 −1 yarn.lock
View
@@ -79,7 +79,8 @@
"qs": "^6.5.0",
"typescript-logging": "^0.3.1",
"version_compare": "^0.0.3",
"x2js": "^3.1.1"
"x2js": "^3.1.1",
"xmldom": "^0.1.27"
},
"scripts": {
"precommit": "jest",
View
@@ -1,16 +1,34 @@
// tslint:disable-next-line
/// <reference path="../../typings/index.d.ts" />
import {IOnmsHTTP} from '../api/IOnmsHTTP';
import {IFilterProcessor} from '../api/IFilterProcessor';
import {OnmsHTTPOptions} from '../api/OnmsHTTPOptions';
import {OnmsResult} from '../api/OnmsResult';
import {OnmsServer} from '../api/OnmsServer';
/** @hidden */
declare const IS_WEB: boolean;
/** @hidden */
const isWeb = typeof(IS_WEB) === 'undefined' ? false : IS_WEB;
if (!global.window) {
global.window = {} as Window;
}
if (!global.window.DOMParser) {
// tslint:disable-next-line
global.window.DOMParser = require('xmldom').DOMParser;
}
/** @hidden */
// tslint:disable-next-line
const X2JS = require('x2js');
/** @hidden */
const xmlParser = new X2JS({
arrayAccessForm: 'property',
attributePrefix: '',
ignoreRoot: true,
});
View
@@ -1 +1,12 @@
/// <reference path="../node_modules/axios/index.d.ts" />
interface Window {
DOMParser: any;
}
declare module NodeJS {
interface Global {
window: Window;
DOMParser: any;
}
}
View
@@ -118,6 +118,8 @@ function createConfig(options) {
}
myconf.plugins.push(new webpack.DefinePlugin(defs));
myconf.plugins.push(new webpack.ProvidePlugin({X2JS: 'x2js'}));
myconf.output.filename += '.js';
return myconf;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 70fd445

Please sign in to comment.