summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-07-26 08:34:05 +0000
committerFelipe Artur <felipefac@gmail.com>2018-07-27 15:09:22 -0300
commitead0424b5c1f80fb933d73e0ec4d876240d5172c (patch)
tree40a9240584f025cfe2965fff9fec70cf668015ef
parent2d0fe45163f0c64163a361d08f0d07e7a3fc2d7d (diff)
downloadgitlab-ce-ead0424b5c1f80fb933d73e0ec4d876240d5172c.tar.gz
Merge branch 'ide-edit-json-files' into 'master'
Fixed IDE not opening JSON files See merge request gitlab-org/gitlab-ce!20798
-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..2a6e6b80de1
--- /dev/null
+++ b/changelogs/unreleased/ide-edit-json-files.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed IDE not opening JSON files
+merge_request: 20798
+author:
+type: fixed
diff --git a/spec/javascripts/ide/stores/actions/file_spec.js b/spec/javascripts/ide/stores/actions/file_spec.js
index 58d3ffc6d94..d8ef473355a 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();