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 @@ -87,8 +87,8 @@ module.exports = ({
87
87
88
88
// handle Link Header (avoid unsafe header warning by existence testing)
89
89
let linkHeader ;
90
- if ( REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) &&
91
- contentType !== 'application/ld+json' ) {
90
+ if ( contentType !== 'application/ld+json' &&
91
+ REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) ) {
92
92
linkHeader = req . getResponseHeader ( 'Link' ) ;
93
93
}
94
94
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