使用矩阵参数创建GET请求
我将使用的web服务需要矩阵参数:
http://tester.com/v1/customers;lastname=Jackson;firstname=Tim;bookingreference=7Y9UIY
而不是通常的
http://tester.com/v1/customers?lastname=Jackson&firstname=Tim&bookingreference=7Y9UIY
无论如何我可以使用Spring UriComponentsBuilder或替代方案创建请求吗?
我知道我可以手动创建它,但希望有一些更精简的可用。
JAX-RS的UriBuilder和WebTarget允许添加矩阵参数。
UriBuilder builder = ... builder.matrixParam("lastname", "Jackson").matrixParam("firstname", "Tim")...
尝试使用given()。urlEncodingEnabled(false)这解决了我的问题。 在给出矩阵参数问题得到解决并且能够正确地命中服务之后