Skip to content

Commit 79efa63

Browse files
committed
use POST method for rest transports
Signed-off-by: Xu Meng <[email protected]>
1 parent 014aabf commit 79efa63

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/transports/irest.js

+7-3
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: `${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/deprecated/iProdFunctional.js

-3
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)