File tree 2 files changed +11
-10
lines changed
2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,8 @@ module.exports = ({
89
89
90
90
// handle Link Header (avoid unsafe header warning by existence testing)
91
91
let linkHeader ;
92
- if ( REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) &&
93
- contentType !== 'application/ld+json' ) {
92
+ if ( contentType !== 'application/ld+json' &&
93
+ REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) ) {
94
94
linkHeader = req . getResponseHeader ( 'Link' ) ;
95
95
}
96
96
if ( linkHeader && contentType !== 'application/ld+json' ) {
Original file line number Diff line number Diff line change @@ -935,16 +935,17 @@ jsonld.get = async function(url, options) {
935
935
}
936
936
} catch ( e ) {
937
937
if ( e . name === 'jsonld.InvalidScriptElement' ) {
938
+ // pass error detected in HTML decode
938
939
throw ( e ) ;
939
- } else {
940
- throw new JsonLdError (
941
- 'Could not retrieve a JSON-LD document from the URL.' ,
942
- 'jsonld.LoadDocumentError' , {
943
- code : 'loading document failed' ,
944
- cause : e ,
945
- remoteDoc
946
- } ) ;
947
940
}
941
+ // otherwise, general loading error
942
+ throw new JsonLdError (
943
+ 'Could not retrieve a JSON-LD document from the URL.' ,
944
+ 'jsonld.LoadDocumentError' , {
945
+ code : 'loading document failed' ,
946
+ cause : e ,
947
+ remoteDoc
948
+ } ) ;
948
949
}
949
950
950
951
return remoteDoc ;
You can’t perform that action at this time.
0 commit comments