From 0247b1509c94c6597886be4616b203758f94a712 Mon Sep 17 00:00:00 2001 From: Boaz Shuster Date: Tue, 6 Dec 2016 23:15:27 +0200 Subject: [PATCH] Update docs and code to use application/x-tar in the build API At the "Build image from Dockerfile" section in the API docs the Content-Type header is missing. In addition, some parts in the code are still setting the Content-Type header to application/tar while it was changed to application/x-tar since 16th September 2015. Signed-off-by: Boaz Shuster --- image_build.go | 2 +- image_build_test.go | 4 ++-- plugin_create.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/image_build.go b/image_build.go index 6fde75dcfd..411d5493ea 100644 --- a/image_build.go +++ b/image_build.go @@ -29,7 +29,7 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio return types.ImageBuildResponse{}, err } headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf)) - headers.Set("Content-Type", "application/tar") + headers.Set("Content-Type", "application/x-tar") serverResp, err := cli.postRaw(ctx, "/build", query, buildContext, headers) if err != nil { diff --git a/image_build_test.go b/image_build_test.go index b9d04f817a..1e18b7bda8 100644 --- a/image_build_test.go +++ b/image_build_test.go @@ -170,8 +170,8 @@ func TestImageBuild(t *testing.T) { return nil, fmt.Errorf("X-Registry-Config header not properly set in the request. Expected '%s', got %s", buildCase.expectedRegistryConfig, registryConfig) } contentType := r.Header.Get("Content-Type") - if contentType != "application/tar" { - return nil, fmt.Errorf("Content-type header not properly set in the request. Expected 'application/tar', got %s", contentType) + if contentType != "application/x-tar" { + return nil, fmt.Errorf("Content-type header not properly set in the request. Expected 'application/x-tar', got %s", contentType) } // Check query parameters diff --git a/plugin_create.go b/plugin_create.go index a660ba5733..27954aa573 100644 --- a/plugin_create.go +++ b/plugin_create.go @@ -12,7 +12,7 @@ import ( // PluginCreate creates a plugin func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions types.PluginCreateOptions) error { headers := http.Header(make(map[string][]string)) - headers.Set("Content-Type", "application/tar") + headers.Set("Content-Type", "application/x-tar") query := url.Values{} query.Set("name", createOptions.RepoName)