简体   繁体   English

邮递员使用具有相同键的多个查询参数获取请求返回空列表

[英]Postman get request with multiple queryparams with the same key returns empty list

I am trying to get a list value of all of my product which corresponds to my research criteria, in my case research criteria are their references and their region by using Postman (GET METHOD):我正在尝试获取与我的研究标准相对应的所有产品的列表值,在我的案例研究标准中,使用 Postman(获取方法)是他们的参考资料和他们的地区:

https://localhost/services/choices/?ref=test1&ref=test2&region=west

But whenever I try to get my references in my code, I receive a list with zero size.但是每当我尝试在代码中获取引用时,我都会收到一个大小为零的列表。

@Path("/choices")
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "get products")
@ApiResponses(value = {@ApiResponse(code=200,message = "Success"),
        @ApiResponse(code=500, message = "Server error")
})
public Response getProduct(@QueryParam("ref") final List<String> ref,
                           @QueryParam("region") final String region,
                          @Context final HttpServletRequest request){
    LOGGER.info("Call for references {} and region {}",ref,region);
    try{


        return Response.ok(productBusinessService.getProducts(ref,region)).build();

    }catch (Exception e){

        throw new InternalServerErrorHttpException("Technical Error", e.getMessage(), e);
    }finally {
        LOGGER.info("End of the Call for references {} and region {}",ref,region);
    }
}

My question is : Is it possible to pass multiple query parameters with the same key name in postman,if yes why do I receive empty list while I get the value of region我的问题是:是否可以在邮递员中传递具有相同键名的多个查询参数,如果是,为什么在获取区域值时会收到空列表

实际上,我必须重新启动我的邮递员客户端才能使其工作,因此重新启动客户端可以作为解决方案

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

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