美文网首页
RestTemplate发送POST带query

RestTemplate发送POST带query

作者: Continue_li | 来源:发表于2020-01-08 22:06 被阅读0次

    RestTemplate template=newRestTemplate();String getUsersUrl=userCenterUrl+"/api/users";HttpHeaders headers=newHttpHeaders();headers.set("Accept",MediaType.APPLICATION_JSON_VALUE);UriComponentsBuilder builder=UriComponentsBuilder.fromUriString(getUsersUrl).queryParam("nameOrEmail",nameOrEmail);HttpEntity<?>entity=newHttpEntity<>(headers);ResponseEntity<List>result=template.exchange(builder.build().encode().toUri(),HttpMethod.POST,entity,List.class);

    相关文章

      网友评论

          本文标题:RestTemplate发送POST带query

          本文链接:https://www.haomeiwen.com/subject/xhpuactx.html