Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alicloud/pop-core

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alicloud/pop-core - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

38

lib/roa.js

@@ -9,2 +9,3 @@ 'use strict';

const httpx = require('httpx');
const xml2js = require('xml2js');
const debug = require('debug')('roa');

@@ -18,2 +19,28 @@

function parseXML(xml) {
const parser = new xml2js.Parser({
// explicitArray: false
});
return new Promise((resolve, reject) => {
parser.parseString(xml, (err, result) => {
if (err) {
return reject(err);
}
resolve(result);
});
});
}
class ACSError extends Error {
constructor(err) {
const message = err.Message[0];
const code = err.Code[0];
const hostid = err.HostId[0];
const requestid = err.RequestId[0];
super(`${message} hostid: ${hostid}, requestid: ${requestid}`);
this.code = code;
}
}
class ROAClient {

@@ -146,2 +173,3 @@ constructor(config) {

const contentType = response.headers['content-type'] || '';
// JSON
if (contentType.startsWith('application/json')) {

@@ -160,2 +188,12 @@ var result = JSON.parse(body);

if (contentType.startsWith('text/xml')) {
return parseXML(body).then((result) => {
if (result.Error) {
return Promise.reject(new ACSError(result.Error));
}
return result;
});
}
return body;

@@ -162,0 +200,0 @@ });

5

package.json
{
"name": "@alicloud/pop-core",
"version": "1.3.0",
"version": "1.3.1",
"description": "AliCloud POP SDK core",

@@ -24,3 +24,4 @@ "main": "index.js",

"httpx": "^2.1.2",
"kitx": "^1.2.1"
"kitx": "^1.2.1",
"xml2js": "^0.4.17"
},

@@ -27,0 +28,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc