File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 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 @@ -943,16 +943,17 @@ jsonld.get = async function(url, options) {
943
943
}
944
944
} catch ( e ) {
945
945
if ( e . name === 'jsonld.InvalidScriptElement' ) {
946
+ // pass error detected in HTML decode
946
947
throw ( e ) ;
947
- } else {
948
- throw new JsonLdError (
949
- 'Could not retrieve a JSON-LD document from the URL.' ,
950
- 'jsonld.LoadDocumentError' , {
951
- code : 'loading document failed' ,
952
- cause : e ,
953
- remoteDoc
954
- } ) ;
955
948
}
949
+ // otherwise, general loading error
950
+ throw new JsonLdError (
951
+ 'Could not retrieve a JSON-LD document from the URL.' ,
952
+ 'jsonld.LoadDocumentError' , {
953
+ code : 'loading document failed' ,
954
+ cause : e ,
955
+ remoteDoc
956
+ } ) ;
956
957
}
957
958
958
959
return remoteDoc ;
You can’t perform that action at this time.
0 commit comments