-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed as not planned
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
We have the following code to retrieve data from a third party.
// Full URL with symbol and query parameter structure
String url = "https://query.theapp.theservice.com/v1/abc/foo/" + foo;
// Prepare query parameters including the crumb and module type
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
queryParams.add("boo", boo);
// Execute the GET request using RestClient and pass full URL with query parameters
ResponseEntity<String> response = restClient.get()
.uri(uriBuilder -> uriBuilder
.replacePath(url) // Use replacePath() with the full URL
.queryParams(queryParams) // Add query parameters
.build())
.header(HttpHeaders.USER_AGENT, "Mozilla/5.0")
.retrieve()
.toEntity(String.class);
With the above code, we get a runtime error:
I/O error on GET request for "https://query.theapp.theservice.com/v1/abc/foo/theFoo": Target host is not specified
We can't find queryParams, but @RequestParam in the document.
We don't know the correction of the following explanation of the error.
The error message "Target host is not specified" suggests that the URL is still not being constructed correctly. This often occurs when the URI handling within RestClient doesn't interpret the URL as fully qualified.
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid