返回html时设置响应头

pull/1121/head
梁宇奇 2025-11-11 21:46:47 +08:00
parent 9682948168
commit 881307a4ea
1 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;
import java.time.Instant;
import java.time.ZoneId;
@ -252,7 +253,8 @@ public class CommonController {
@ApiOperation("获取html内容")
@GetMapping("/html/content/{title}")
public String getHtmlContent(@PathVariable("title") String title) {
public String getHtmlContent(@PathVariable("title") String title, HttpServletResponse response) {
response.setHeader("X-Frame-Options", "ALLOWALL");
return htmlService.getHtmlContent(title);
}