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

@adobe/acc-js-sdk

Package Overview
Dependencies
Maintainers
21
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/acc-js-sdk - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

5

CHANGELOG.md

@@ -8,2 +8,7 @@ # Adobe Campaign Classic (ACC) SDK in JavaScript (node.js and browser)

## Version 1.1.1
_2022/03/10_
* Fixed an issue with encoding: make the default charset encoding to be UTF-8 (https://github.com/adobe/acc-js-sdk/issues/26)
## Version 1.1.0

@@ -10,0 +15,0 @@ _2022/03/05_

2

package.json
{
"name": "@adobe/acc-js-sdk",
"version": "1.1.0",
"version": "1.1.1",
"description": "ACC Javascript SDK",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -81,2 +81,3 @@ /*

* @param {string} userAgentString The user agent string to use for HTTP requests
* @param {string} charset The charset encoding used for http requests, usually UTF-8
* @memberof SOAP

@@ -86,3 +87,3 @@ */

constructor(transport, urn, methodName, sessionToken, securityToken, userAgentString) {
constructor(transport, urn, methodName, sessionToken, securityToken, userAgentString, charset) {
this.request = undefined; // The HTTP request (object litteral passed to the transport layer)

@@ -104,2 +105,3 @@ this.response = undefined; // The HTTP response object (in case of success)

this._userAgentString = userAgentString;
this._charset = charset || "";

@@ -518,2 +520,3 @@ // THe SOAP call being built

_createHTTPRequest(url) {
const options = {

@@ -523,3 +526,3 @@ url: url,

headers: {
'Content-type': 'application/soap+xml',
'Content-type': `application/soap+xml${this._charset ? ";charset=" + this._charset : ""}`,
'SoapAction': `${this.urn}#${this.methodName}`,

@@ -526,0 +529,0 @@ 'X-Security-Token': this._securityToken

@@ -24,7 +24,8 @@ /*

const assert = require('assert');
const sdk = require('../src/index.js');
const URL = "https://soap-test/nl/jsp/soaprouter.jsp";
function makeSoapMethodCall(transport, urn, methodName, sessionToken, securityToken, userAgentString) {
const call = new SoapMethodCall(transport, urn, methodName, sessionToken, securityToken, userAgentString);
function makeSoapMethodCall(transport, urn, methodName, sessionToken, securityToken, userAgentString, optionalCharset) {
const call = new SoapMethodCall(transport, urn, methodName, sessionToken, securityToken, userAgentString, optionalCharset);
return call;

@@ -686,2 +687,52 @@ }

});
describe("Charset encoding", function() {
it("Should support no encoding", function() {
const call = makeSoapMethodCall(undefined, "xtk:session", "Empty");
const request = call._createHTTPRequest(URL);
assert.equal(request.url, URL);
assert.equal(request.headers["Content-type"], "application/soap+xml");
});
it("Should support UTF-8 encoding", function() {
const call = makeSoapMethodCall(undefined, "xtk:session", "Empty", undefined, undefined, undefined, "UTF-8");
const request = call._createHTTPRequest(URL);
assert.equal(request.url, URL);
assert.equal(request.headers["Content-type"], "application/soap+xml;charset=UTF-8");
});
it("Default encoding should be UTF-8", async () => {
const connectionParameters = sdk.ConnectionParameters.ofSessionToken("http://acc-sdk:8080", "mc/");
const client = await sdk.init(connectionParameters);
client._transport = jest.fn();
expect(client._connectionParameters._options.charset).toBe('UTF-8');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
expect (soapCall._charset).toBe('UTF-8');
const request = soapCall._createHTTPRequest(URL);
assert.equal(request.headers["Content-type"], "application/soap+xml;charset=UTF-8");
})
it("Default support forcing an empty encoding", async () => {
const connectionParameters = sdk.ConnectionParameters.ofSessionToken("http://acc-sdk:8080", "mc/", { charset: "" });
const client = await sdk.init(connectionParameters);
client._transport = jest.fn();
expect(client._connectionParameters._options.charset).toBe('');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
expect (soapCall._charset).toBe('');
const request = soapCall._createHTTPRequest(URL);
assert.equal(request.headers["Content-type"], "application/soap+xml");
})
it("Default support forcing an ISO charset", async () => {
const connectionParameters = sdk.ConnectionParameters.ofSessionToken("http://acc-sdk:8080", "mc/", { charset: "ISO-8859-1" });
const client = await sdk.init(connectionParameters);
client._transport = jest.fn();
expect(client._connectionParameters._options.charset).toBe('ISO-8859-1');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
expect (soapCall._charset).toBe('ISO-8859-1');
const request = soapCall._createHTTPRequest(URL);
assert.equal(request.headers["Content-type"], "application/soap+xml;charset=ISO-8859-1");
})
});

@@ -688,0 +739,0 @@ });

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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