File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -571,11 +571,18 @@ async function getJSONwithEmbeddedContext(json_document: vscode.TextDocument) {
571
571
} )
572
572
console . log ( response ) ;
573
573
574
- if ( response . headers [ 'content-type' ] != 'application/json' || response . headers [ 'content-type' ] != 'text/json' || response . headers [ 'content-type' ] != 'application/ld+json' ) {
574
+ if ( response . headers [ 'content-type' ] != 'application/json' && response . headers [ 'content-type' ] != 'text/json' && response . headers [ 'content-type' ] != 'application/ld+json' ) {
575
575
throw new Error ( "Service did not return JSON content type: " + response . headers [ 'content-type' ] ) ;
576
576
}
577
577
578
- const remote_context = response . data ;
578
+
579
+ var remote_context = response . data ;
580
+
581
+ if ( typeof remote_context == 'string' ) {
582
+ // Ensure that the returned response can be parsed as data
583
+ remote_context = JSON . parse ( remote_context ) ;
584
+ }
585
+
579
586
outputChannel . appendLine ( "Preloaded context from " + context [ c ] ) ;
580
587
expandedContextArray . push ( remote_context ) ;
581
588
} catch ( e : any ) {
You can’t perform that action at this time.
0 commit comments