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 = ({
8989
9090 // handle Link Header (avoid unsafe header warning by existence testing)
9191 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 ( ) ) ) {
9494 linkHeader = req . getResponseHeader ( 'Link' ) ;
9595 }
9696 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) {
943943 }
944944 } catch ( e ) {
945945 if ( e . name === 'jsonld.InvalidScriptElement' ) {
946+ // pass error detected in HTML decode
946947 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- } ) ;
955948 }
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+ } ) ;
956957 }
957958
958959 return remoteDoc ;
You can’t perform that action at this time.
0 commit comments