andreaturli commented on this pull request.


> +import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class AddApiVersionToRequest implements HttpRequestFilter {
+
+    private final String apiVersion;
+
+    @Inject
+    public AddApiVersionToRequest(@ApiVersion String apiVersion) {
+        this.apiVersion = checkNotNull(apiVersion, "apiVersion");
+    }
+
+    @Override
+    public HttpRequest filter(final HttpRequest request) throws HttpException {
+        return request.toBuilder()
+                .replaceHeader(HttpHeaders.ACCEPT, 
String.format("application/json; version=%s", apiVersion))

I've slightly modified the logic, it now gets the previous `accept` header, 
which must be there because of @Consume, and append the `version=<value>` to it

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/343

Reply via email to