You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Look for existing test patterns before creating new structures
134
134
- Use `describe` and `test` consistently with existing patterns
135
135
- If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task
136
+
- Do not use `any` or `unknown` as the type for variables, parameters, or return values unless absolutely necessary. If they need type annotations, they should have proper types or interfaces defined.
// Use URL constructor for normalization - it handles hostname case and trailing slashes
1055
+
constprmValue=newURL(body.resource).toString();
1056
+
consttargetValue=targetResourceUrlObj.toString();
1057
+
if(prmValue!==targetValue){
1058
+
thrownewError(`Protected Resource Metadata resource property value "${prmValue}" (length: ${prmValue.length}) does not match target server url "${targetValue}" (length: ${targetValue.length}). These MUST match to follow OAuth spec https://datatracker.ietf.org/doc/html/rfc9728#PRConfigurationValidation`);
1059
+
}
1060
+
returnbody;
1061
+
}else{
1062
+
errors.push(newError(`Invalid resource metadata from ${urlToTry}. Expected to follow shape of https://datatracker.ietf.org/doc/html/rfc9728#name-protected-resource-metadata (Hints: is scopes_supported an array? Is resource a string?). Current payload: ${JSON.stringify(body)}`));
1063
+
continue;
1064
+
}
1065
+
}catch(e){
1066
+
errors.push(einstanceofError ? e : newError(String(e)));
1067
+
continue;
1068
+
}
1069
+
}
1070
+
// If we've tried all URLs and none worked, throw the error(s)
1071
+
if(errors.length===1){
1072
+
throwerrors[0];
1073
+
}else{
1074
+
thrownewAggregateError(errors,'Failed to fetch resource metadata from all attempted URLs');
0 commit comments