Merge pull request #144623 from AnWeber/main

Fix #144622 using mime text/x-json instead of application/json
This commit is contained in:
Peng Lyu 2022-03-07 14:02:58 -08:00 committed by GitHub
commit ab49f4f310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -3204,7 +3204,7 @@ export class NotebookCellOutputItem {
return new NotebookCellOutputItem(bytes, mime);
}
static json(value: any, mime: string = 'application/json'): NotebookCellOutputItem {
static json(value: any, mime: string = 'text/x-json'): NotebookCellOutputItem {
const rawStr = JSON.stringify(value, undefined, '\t');
return NotebookCellOutputItem.text(rawStr, mime);
}

View file

@ -679,7 +679,7 @@ suite('ExtHostTypes', function () {
// --- JSON
item = types.NotebookCellOutputItem.json(1);
assert.strictEqual(item.mime, 'application/json');
assert.strictEqual(item.mime, 'text/x-json');
assert.deepStrictEqual(item.data, new TextEncoder().encode(JSON.stringify(1)));
item = types.NotebookCellOutputItem.json(1, 'foo/bar');
@ -687,11 +687,11 @@ suite('ExtHostTypes', function () {
assert.deepStrictEqual(item.data, new TextEncoder().encode(JSON.stringify(1)));
item = types.NotebookCellOutputItem.json(true);
assert.strictEqual(item.mime, 'application/json');
assert.strictEqual(item.mime, 'text/x-json');
assert.deepStrictEqual(item.data, new TextEncoder().encode(JSON.stringify(true)));
item = types.NotebookCellOutputItem.json([true, 1, 'ddd']);
assert.strictEqual(item.mime, 'application/json');
assert.strictEqual(item.mime, 'text/x-json');
assert.deepStrictEqual(item.data, new TextEncoder().encode(JSON.stringify([true, 1, 'ddd'], undefined, '\t')));
// --- text