Skip to content

Commit

Permalink
fix(webhook): Supply additional context when fetching RestTemplate (#…
Browse files Browse the repository at this point in the history
…3045)

This supports the use-case of needing a specific `RestTemplate`
per url.
  • Loading branch information
ajordens authored Jul 17, 2019
1 parent a966ce2 commit 7141c02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public boolean supports(String targetUrl) {
}

@Override
public RestTemplate getRestTemplate() {
public RestTemplate getRestTemplate(String targetUrl) {
return restTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ default String getTargetUrl(String targetUrl) {
}

/** @return a configured {@code RestTemplate} */
RestTemplate getRestTemplate();
RestTemplate getRestTemplate(String targetUrl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class WebhookService {
)
HttpHeaders headers = buildHttpHeaders(customHeaders)
HttpEntity<Object> payloadEntity = new HttpEntity<>(payload, headers)
return restTemplateProvider.getRestTemplate().exchange(validatedUri, httpMethod, payloadEntity, Object)
return restTemplateProvider.getRestTemplate(url).exchange(validatedUri, httpMethod, payloadEntity, Object)
}

ResponseEntity<Object> getStatus(String url, Object customHeaders) {
Expand Down

0 comments on commit 7141c02

Please sign in to comment.