Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/doc/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
ash -c '
mkdir -p /var/snippets/node;
apk add --no-cache curl;
npm install -g eslint;
npm install -g eslint@6.8.0;
cd /var/snippets/node;
npm install \
bluebird \
Expand All @@ -76,7 +76,7 @@ services:
apt-get update;
apt-get install -y curl;
npm install -g \
eslint;
eslint@6.8.0;
cd /mnt;
npm install;
cd /var/snippets/web;
Expand Down Expand Up @@ -105,7 +105,7 @@ services:
apt-get update;
apt-get install -y curl;
npm install -g \
eslint;
eslint@6.8.0;
cd /var/snippets/webpack;
cp /mnt/.ci/doc/puppeteer.js /var/snippets/webpack/;
cp /mnt/.ci/doc/webpackBuild.js /var/snippets/webpack/;
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- npm install

script:
- npm run lint
- npm run unit-testing
- npm run test:lint
- npm run test:unit

after_success:
- cat ./coverage/lcov.info | ./node_modules/.bin/codecov
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- npm run build

script:
- npm run functional-testing
- npm run test:functional

- stage: Tests
name: Documentation Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hooks:
curl -H "Content-type: application/json" -d '{"capacity": 7}' kuzzle:7512/nyc-open-data/yellow-taxi/_create
done

curl -XPOST kuzzle:7512/nyc-open-data/_refresh
curl -XPOST kuzzle:7512/nyc-open-data/yellow-taxi/_refresh
after:
template: default
expected: Successfully deleted 5 documents
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"scripts": {
"prepublishOnly": "npm run build",
"test": "npm run --silent lint && npm run unit-testing && npm run functional-testing",
"unit-testing": "nyc --reporter=text-summary --reporter=lcov mocha",
"functional-testing": "cucumber-js --exit --fail-fast",
"lint": "eslint --max-warnings=0 ./src ./test ./features",
"test:unit": "nyc --reporter=text-summary --reporter=lcov mocha",
"test:functional": "cucumber-js --exit --fail-fast",
"test:lint": "eslint --max-warnings=0 ./src ./test ./features",
"build": "node build.js",
"doc": "docker-compose -f doc/docker-compose.yml up",
"doc-testing": "bash .ci/test-docs.sh",
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/Http.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class HttpProtocol extends BaseProtocol {
}
}
else {
queryString.push(`${key}=${value}`);
queryString.push(`${key}=${typeof value === 'object' ? JSON.stringify(value) : value}`);
}
}

Expand Down
24 changes: 24 additions & 0 deletions test/protocol/Http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,30 @@ describe('HTTP networking module', () => {
protocol.send(data);
});

it('should inject the nested body object as querystring on a GET request', done => {
const data = {
requestId: 'requestId',
action: 'action',
controller: 'getreq',
body: { foo: { foofoo: { barbar: 'bar' } }, baz: ['oh', 'an', 'array'] }
};

protocol.on('requestId', () => {
try {
should(protocol._sendHttpRequest).be.calledOnce();
should(protocol._sendHttpRequest.firstCall.args[0]).be.equal('GET');
should(protocol._sendHttpRequest.firstCall.args[1])
.be.equal('/foo?foo={"foofoo":{"barbar":"bar"}}&baz=oh,an,array');
done();
}
catch (error) {
done(error);
}
});

protocol.send(data);
});

it('should inject queryString to the HTTP request', done => {
const data = {
requestId: 'requestId',
Expand Down