File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -48,28 +48,20 @@ const fetchAndParse = async (url, parser) => {
4848 }
4949} ;
5050
51- /**
52- * Checks if the response URL ends with any of the specified endings and if the response is OK.
53- * @param {Response } response - The fetch response object.
54- * @param {string[] } endings - An array of URL endings to check against.
55- * @returns {boolean } - Returns true if the response is OK and the URL ends with one of the specified endings.
56- */
57- const isPresent = ( response , endings ) => response . ok && endings . some ( ending => response . url . endsWith ( ending ) ) ;
58-
5951/**
6052 * Parses the response from a DSR delete request.
6153 * @param {Response } response - The response object from the fetch request.
6254 * @returns {Promise<Object> } A promise that resolves to an object containing the parsed response data.
6355 */
6456const parseDSRdelete = async ( response ) => {
6557 let result = {
66- present : isPresent ( response , [ '/dsrdelete.json' ] ) ,
58+ present : response . ok && response . url . endsWith ( '/dsrdelete.json' ) && response . headers . get ( 'content-type' ) === 'application/json' ,
6759 status : response . status ,
6860 } ;
6961 Object . assign ( result , result . present ? { redirected : response . redirected } : { } ) ;
7062
7163 try {
72- let content = JSON . parse ( await response . text ( ) ) ;
64+ let content = JSON . parse ( response . text ( ) ) ;
7365 if ( result . present && content ) {
7466 for ( const element of content . identifiers ) {
7567 delete element . id ;
You can’t perform that action at this time.
0 commit comments