Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes url check for w3id #145

Merged
merged 4 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
@Slf4j
public class CheckUrlController {

public static final String ACCEPTED_MIME_TYPES =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,"
+ "image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";

@GetMapping
@SneakyThrows
@Operation(
Expand All @@ -38,6 +42,7 @@ public ResponseEntity<?> check(@RequestParam String url) {
log.info("Checking url {}", url);
HttpURLConnection huc = (HttpURLConnection) new URL(url).openConnection();
huc.setConnectTimeout(5000);
huc.setRequestProperty("Accept", ACCEPTED_MIME_TYPES);
log.info("Response code for url {} is : {}", url, huc.getResponseCode());
return new ResponseEntity<>(HttpStatus.valueOf(huc.getResponseCode()));
}
Expand Down
Loading