In Postman I'm sending the following request: img1 img2
I'm getting the expected response, with the limit being taken into account.
Here's my Spring RestTemplate implementation:
String url = "https://somedomain.com/api/v1/xyz";
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("limit", "1");
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "<CENSORED>");
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
ResponseEntity<SomeClass> response;
try {
response = restTemplate.exchange(url, HttpMethod.GET, request, SomeClass.class);
} catch (RestClientException e) {
// not important
}
In the response, the limit is not taken into account. It's like not having sent the limit at all.
Here's what my application logs:
==============================request start==============================
URI : https://somedomain.com/api/v1/xyz
Method : GET
Headers : [Accept:"application/json, application/*+json", Authorization:"<CENSORED>", Content-Type:"application/x-www-form-urlencoded;charset=UTF-8", Content-Length:"7"]
Request body: limit=1
===============================request end===============================
==============================response start=============================
Status code : 200 OK
Status text : OK
Headers : // some headers
Response body: // response
==============================response end===============================
Any idea what might be the problem? If I set Content-Length to 7 manually in Postman it still works.
Thank you!