22301102 | 8fd30b8 | 2025-06-05 18:02:21 +0800 | [diff] [blame] | 1 | package com.pt.testResponse; |
| 2 | |
22301102 | f567030 | 2025-06-08 14:10:02 +0800 | [diff] [blame^] | 3 | import com.pt.CustomResponse; |
22301102 | 8fd30b8 | 2025-06-05 18:02:21 +0800 | [diff] [blame] | 4 | import org.springframework.web.bind.annotation.CrossOrigin; |
| 5 | import org.springframework.web.bind.annotation.GetMapping; |
| 6 | import org.springframework.web.bind.annotation.RestController; |
| 7 | |
22301102 | f567030 | 2025-06-08 14:10:02 +0800 | [diff] [blame^] | 8 | import java.util.Map; |
| 9 | |
22301102 | 8fd30b8 | 2025-06-05 18:02:21 +0800 | [diff] [blame] | 10 | @RestController |
| 11 | @CrossOrigin(origins = "*") |
| 12 | public class TestController { |
| 13 | |
22301102 | b04a60d | 2025-06-05 18:02:21 +0800 | [diff] [blame] | 14 | @GetMapping("/api/test") |
22301102 | f567030 | 2025-06-08 14:10:02 +0800 | [diff] [blame^] | 15 | public CustomResponse testResponse() { |
| 16 | return new CustomResponse( |
| 17 | 1, |
| 18 | "This is a test response", |
| 19 | Map.of( |
| 20 | "key1", "value1", |
| 21 | "key2", "value2" |
| 22 | ) |
| 23 | ); |
22301102 | 8fd30b8 | 2025-06-05 18:02:21 +0800 | [diff] [blame] | 24 | } |
| 25 | } |