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 @@ -935,16 +935,17 @@ jsonld.get = async function(url, options) {
935935 }
936936 } catch ( e ) {
937937 if ( e . name === 'jsonld.InvalidScriptElement' ) {
938+ // pass error detected in HTML decode
938939 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- } ) ;
947940 }
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+ } ) ;
948949 }
949950
950951 return remoteDoc ;
You can’t perform that action at this time.
0 commit comments