mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Merge pull request #144623 from AnWeber/main
Fix #144622 using mime text/x-json instead of application/json
This commit is contained in:
commit
ab49f4f310
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue