mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
remove asJson header restriction
This commit is contained in:
@@ -165,13 +165,15 @@ export function asJson<T>(context: IRequestContext): TPromise<T> {
|
||||
return c(null);
|
||||
}
|
||||
|
||||
if (!/application\/json/.test(context.res.headers['content-type'])) {
|
||||
return e('Response doesn\'t appear to be JSON');
|
||||
}
|
||||
|
||||
const buffer: string[] = [];
|
||||
context.stream.on('data', (d: string) => buffer.push(d));
|
||||
context.stream.on('end', () => c(JSON.parse(buffer.join(''))));
|
||||
context.stream.on('end', () => {
|
||||
try {
|
||||
c(JSON.parse(buffer.join('')));
|
||||
} catch (err) {
|
||||
e(err);
|
||||
}
|
||||
});
|
||||
context.stream.on('error', e);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user