> +    this.creds = ((Supplier)Preconditions.checkNotNull(creds, "creds"));
> +    this.apiVersion = apiVersion;
> +  }
> +
> +  public HttpRequest filter(HttpRequest request) throws HttpException
> +  {
> +    Credentials currentCreds = 
> (Credentials)Preconditions.checkNotNull(this.creds.get(), "credential 
> supplier returned null");
> +    String acceptType = request.getFirstHeaderOrNull("Accept") == null ? 
> "application/*+xml" : request.getFirstHeaderOrNull("Accept");
> +
> +    String version = ";version=" + this.apiVersion;
> +    String acceptHeader = acceptType + version;
> +
> +    request = 
> ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new 
> String[] { acceptHeader })).build();
> +
> +    return 
> ((HttpRequest.Builder)request.toBuilder().replaceHeader("Authorization", new 
> String[] { BasicAuthentication.basic(currentCreds.identity, 
> currentCreds.credential) })).build();
> +  }

this looks like conflating authentication with the accept header. maybe 2 
filters is a better idea.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/418/files#r18427601

Reply via email to