@GetMapping(path = "/download")
    public ResponseEntity<byte[]> downloadFile(@RequestParam(value = "body", defaultValue = "") final String body) throws IOException {
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);

        String downloadFileName = URLEncoder.encode("downloadFile.txt", StandardCharsets.UTF_8);
        headers.setContentDispositionFormData("attachment", downloadFileName);

        return new ResponseEntity<>(body.getBytes(StandardCharsets.UTF_8), headers, HttpStatus.CREATED);
    }
download file.

@param body file content
@return file
@throws IOException io exception
shenyu-examples/shenyu-examples-http/src/main/java/org/apache/shenyu/examples/http/controller/HttpTestController.java