summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-07-24 08:55:59 +0100
committerPhil Hughes <me@iamphill.com>2018-07-24 08:55:59 +0100
commit45693517dfde7cbd59b58302d489ecdd0811922b (patch)
tree81ddf6693e679a5e087da7c446b5a6fa8f1fabac
parent943c51e43d343b6ab3ec90b74743ebc95b621e21 (diff)
downloadgitlab-ce-ide-edit-json-files.tar.gz
Fixed IDE not opening JSON fileside-edit-json-files
-rw-r--r--app/assets/javascripts/ide/services/index.js4
-rw-r--r--changelogs/unreleased/ide-edit-json-files.yml5
-rw-r--r--spec/javascripts/ide/stores/actions/file_spec.js17
3 files changed, 24 insertions, 2 deletions
diff --git a/app/assets/javascripts/ide/services/index.js b/app/assets/javascripts/ide/services/index.js
index 49a481f25d5..cb93fba1665 100644
--- a/app/assets/javascripts/ide/services/index.js
+++ b/app/assets/javascripts/ide/services/index.js
@@ -18,7 +18,7 @@ export default {
return axios
.get(file.rawPath, {
- params: { format: 'json' },
+ transformResponse: [f => f],
})
.then(({ data }) => data);
},
@@ -33,7 +33,7 @@ export default {
return axios
.get(file.rawPath.replace(`/raw/${file.branchId}/${file.path}`, `/raw/${sha}/${file.path}`), {
- params: { format: 'json' },
+ transformResponse: [f => f],
})
.then(({ data }) => data);
},
diff --git a/changelogs/unreleased/ide-edit-json-files.yml b/changelogs/unreleased/ide-edit-json-files.yml
new file mode 100644
index 00000000000..cfe74f6c93c
--- /dev/null
+++ b/changelogs/unreleased/ide-edit-json-files.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed IDE not opening JSON files
+merge_request:
+author:
+type: fixed
diff --git a/spec/javascripts/ide/stores/actions/file_spec.js b/spec/javascripts/ide/stores/actions/file_spec.js
index f570c0b16bd..72eb20bdc87 100644
--- a/spec/javascripts/ide/stores/actions/file_spec.js
+++ b/spec/javascripts/ide/stores/actions/file_spec.js
@@ -366,6 +366,23 @@ describe('IDE store file actions', () => {
});
});
+ describe('return JSON', () => {
+ beforeEach(() => {
+ mock.onGet(/(.*)/).replyOnce(200, JSON.stringify({ test: '123' }));
+ });
+
+ it('does not parse returned JSON', done => {
+ store
+ .dispatch('getRawFileData', { path: tmpFile.path })
+ .then(() => {
+ expect(tmpFile.raw).toEqual('{"test":"123"}');
+
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
+
describe('error', () => {
beforeEach(() => {
mock.onGet(/(.*)/).networkError();