简体   繁体   English

Postman 无法读取 URL 的最后一位

[英]Postman is unable to read last digit of URL

@RequestMapping(value = "base/limit/{sysId}/{startDate}/{endDate}?{limitIds}", 
                method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
        public Object getLimitIds(
                @PathVariable String baseId,
                @PathVariable String startDate, 
                @PathVariable String endDate,
                @RequestParam(required=false) String limitIds )

example: GET: http://localhost:8080/base/limit/fab41439/2022-11-22-02:09:11/2022-12-22-02:09:35?limitIds=23,45,56示例:获取:http://localhost:8080/base/limit/fab41439/2022-11-22-02:09:11/2022-12-22-02:09:35?limitIds=23,45,56

When I print endDate I get below this missing last digit 5 "endDate 2022-12-01-02:09:3"当我打印 endDate 时,我得到低于这个缺失的最后一位数字 5“endDate 2022-12-01-02:09:3”

expected: 2022-12-22-02:09:35预计:2022-12-22-02:09:35

Actually prints: endDate 2022-12-01-02:09:3实际打印:endDate 2022-12-01-02:09:3

I tried all possible ways restart, clean build,DateFormat nothing worked.我尝试了所有可能的方式重新启动,清理构建,DateFormat 没有任何效果。

You had baseId as a pathVariable but it does not exists so i change it to sysId because its the only one missing您将 baseId 作为 pathVariable,但它不存在,所以我将其更改为 sysId,因为它是唯一缺少的

the url used使用的 url

http://localhost:8080/base/limit/fab41439/2022-11-22-02:09:11/2022-12-22-02:09:35?limitIds=23,45,56

the method is void for testing you can change to whatever you want it to return该方法对于测试无效,您可以更改为您希望它返回的任何内容

@GetMapping("/base/limit/{sysId}/{startDate}/{endDate}")
public void getLimitIds(
        @PathVariable String sysId,
        @PathVariable String startDate,
        @PathVariable String endDate,
        @RequestParam(required=false) String limitIds){

    System.out.println(sysId);
    System.out.println(startDate);
    System.out.println(endDate);
    System.out.println(limitIds);
}

print result打印结果

fab41439
2022-11-22-02:09:11
2022-12-22-02:09:35
23,45,56

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM