Skip to content

Commit

Permalink
Switch to using extension for mediaType detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed May 30, 2024
1 parent 6cff342 commit a1679f6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class SpaController {
public ResponseEntity<Resource> getStaticFileWithoutCacheHeaders(@PathVariable String filename) {
FileSystemResource resource = (FileSystemResource) resourceLoader.getResource("/" + filename);
if (resource.exists()) {
MediaType mediaType = filename.equalsIgnoreCase("service-worker") ? MediaType.parseMediaType("text/javascript") : MediaType.APPLICATION_JSON;
MediaType mediaType = filename.endsWith(".js") ? MediaType.parseMediaType("text/javascript") : MediaType.APPLICATION_JSON;

return ResponseEntity.ok()
.cacheControl(CacheControl.noCache().mustRevalidate())
Expand Down

0 comments on commit a1679f6

Please sign in to comment.