Skip to content

Commit

Permalink
Add User-Agent when requesting information from AWS Metadata service (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
willbengtson authored and troshko111 committed Sep 17, 2018
1 parent cea84e3 commit ec2649e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static String readEc2MetadataUrl(MetaDataKey metaDataKey, URL url, int co
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.setConnectTimeout(connectionTimeoutMs);
uc.setReadTimeout(readTimeoutMs);
uc.setRequestProperty("User-Agent", "eureka-java-client");

if (uc.getResponseCode() != HttpURLConnection.HTTP_OK) { // need to read the error for clean connection close
BufferedReader br = new BufferedReader(new InputStreamReader(uc.getErrorStream()));
Expand Down

0 comments on commit ec2649e

Please sign in to comment.