Skip to content

Commit 6a9f91f

Browse files
dmabuptabmusse
authored andcommitted
Use POST method for REST transport (#66)
* use POST method for rest transports * enable skipped test cases for `getInstalledProducts()` Signed-off-by: Xu Meng <mengxumx@cn.ibm.com>
1 parent 014aabf commit 6a9f91f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

lib/transports/irest.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ const iRestHttp = (config, xmlInput, done) => {
5959
const options = {
6060
host,
6161
port,
62-
path: `${path}?${xmlEnc}`,
63-
method: 'GET',
62+
path,
63+
method: 'POST',
64+
headers: {
65+
'Content-Type': 'application/x-www-form-urlencoded',
66+
'Content-Length': Buffer.byteLength(xmlEnc)
67+
}
6468
};
6569

6670
const request = http.request(options, (response) => {
@@ -78,7 +82,7 @@ const iRestHttp = (config, xmlInput, done) => {
7882
request.on('error', (error) => {
7983
done(error, null);
8084
});
81-
85+
request.write(xmlEnc);
8286
request.end();
8387
};
8488

test/functional/ToolkitFunctional.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,6 @@ describe('Toolkit Functional Tests', () => {
653653
transports.forEach((transport) => {
654654
// eslint-disable-next-line func-names
655655
it(`returns info for installed products using ${transport.name} transport`, function (done) {
656-
if (transport.name === 'rest') {
657-
this.skip();
658-
}
659656
const connection = transport.me;
660657

661658
const toolkit = new Toolkit(connection);

test/functional/deprecated/iProdFunctional.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ describe('iProd Functional Tests', () => {
129129
transports.forEach((transport) => {
130130
// eslint-disable-next-line func-names
131131
it(`returns info for installed products using ${transport.name} transport`, function (done) {
132-
if (transport.name === 'rest') {
133-
this.skip();
134-
}
135132
const connection = transport.me;
136133

137134
const prod = new iProd(connection);

0 commit comments

Comments
 (0)