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 <ripcurld.github@gmail.com>
| ... | ... |
@@ -4399,8 +4399,8 @@ paths: |
| 4399 | 4399 |
in: "header" |
| 4400 | 4400 |
type: "string" |
| 4401 | 4401 |
enum: |
| 4402 |
- - "application/tar" |
|
| 4403 |
- default: "application/tar" |
|
| 4402 |
+ - "application/x-tar" |
|
| 4403 |
+ default: "application/x-tar" |
|
| 4404 | 4404 |
- name: "X-Registry-Config" |
| 4405 | 4405 |
in: "header" |
| 4406 | 4406 |
description: | |
| ... | ... |
@@ -29,7 +29,7 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio |
| 29 | 29 |
return types.ImageBuildResponse{}, err
|
| 30 | 30 |
} |
| 31 | 31 |
headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf))
|
| 32 |
- headers.Set("Content-Type", "application/tar")
|
|
| 32 |
+ headers.Set("Content-Type", "application/x-tar")
|
|
| 33 | 33 |
|
| 34 | 34 |
serverResp, err := cli.postRaw(ctx, "/build", query, buildContext, headers) |
| 35 | 35 |
if err != nil {
|
| ... | ... |
@@ -170,8 +170,8 @@ func TestImageBuild(t *testing.T) {
|
| 170 | 170 |
return nil, fmt.Errorf("X-Registry-Config header not properly set in the request. Expected '%s', got %s", buildCase.expectedRegistryConfig, registryConfig)
|
| 171 | 171 |
} |
| 172 | 172 |
contentType := r.Header.Get("Content-Type")
|
| 173 |
- if contentType != "application/tar" {
|
|
| 174 |
- return nil, fmt.Errorf("Content-type header not properly set in the request. Expected 'application/tar', got %s", contentType)
|
|
| 173 |
+ if contentType != "application/x-tar" {
|
|
| 174 |
+ return nil, fmt.Errorf("Content-type header not properly set in the request. Expected 'application/x-tar', got %s", contentType)
|
|
| 175 | 175 |
} |
| 176 | 176 |
|
| 177 | 177 |
// Check query parameters |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
// PluginCreate creates a plugin |
| 13 | 13 |
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions types.PluginCreateOptions) error {
|
| 14 | 14 |
headers := http.Header(make(map[string][]string)) |
| 15 |
- headers.Set("Content-Type", "application/tar")
|
|
| 15 |
+ headers.Set("Content-Type", "application/x-tar")
|
|
| 16 | 16 |
|
| 17 | 17 |
query := url.Values{}
|
| 18 | 18 |
query.Set("name", createOptions.RepoName)
|
| ... | ... |
@@ -1192,6 +1192,7 @@ Build an image from a Dockerfile |
| 1192 | 1192 |
**Example request**: |
| 1193 | 1193 |
|
| 1194 | 1194 |
POST /v1.18/build HTTP/1.1 |
| 1195 |
+ Content-Type: application/x-tar |
|
| 1195 | 1196 |
|
| 1196 | 1197 |
{% raw %}
|
| 1197 | 1198 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1246,7 +1247,7 @@ or being killed. |
| 1246 | 1246 |
|
| 1247 | 1247 |
**Request Headers**: |
| 1248 | 1248 |
|
| 1249 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1249 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1250 | 1250 |
- **X-Registry-Config** – base64-encoded ConfigFile object |
| 1251 | 1251 |
|
| 1252 | 1252 |
**Status codes**: |
| ... | ... |
@@ -1236,6 +1236,7 @@ Build an image from a Dockerfile |
| 1236 | 1236 |
**Example request**: |
| 1237 | 1237 |
|
| 1238 | 1238 |
POST /v1.19/build HTTP/1.1 |
| 1239 |
+ Content-Type: application/x-tar |
|
| 1239 | 1240 |
|
| 1240 | 1241 |
{% raw %}
|
| 1241 | 1242 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1292,7 +1293,7 @@ or being killed. |
| 1292 | 1292 |
|
| 1293 | 1293 |
**Request Headers**: |
| 1294 | 1294 |
|
| 1295 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1295 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1296 | 1296 |
- **X-Registry-Config** – base64-encoded ConfigFile object |
| 1297 | 1297 |
|
| 1298 | 1298 |
**Status codes**: |
| ... | ... |
@@ -1365,6 +1365,7 @@ Build an image from a Dockerfile |
| 1365 | 1365 |
**Example request**: |
| 1366 | 1366 |
|
| 1367 | 1367 |
POST /v1.20/build HTTP/1.1 |
| 1368 |
+ Content-Type: application/x-tar |
|
| 1368 | 1369 |
|
| 1369 | 1370 |
{% raw %}
|
| 1370 | 1371 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1425,7 +1426,7 @@ or being killed. |
| 1425 | 1425 |
|
| 1426 | 1426 |
**Request Headers**: |
| 1427 | 1427 |
|
| 1428 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1428 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1429 | 1429 |
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON |
| 1430 | 1430 |
object with the following structure: |
| 1431 | 1431 |
|
| ... | ... |
@@ -1448,6 +1448,7 @@ Build an image from a Dockerfile |
| 1448 | 1448 |
**Example request**: |
| 1449 | 1449 |
|
| 1450 | 1450 |
POST /v1.21/build HTTP/1.1 |
| 1451 |
+ Content-Type: application/x-tar |
|
| 1451 | 1452 |
|
| 1452 | 1453 |
{% raw %}
|
| 1453 | 1454 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1514,7 +1515,7 @@ or being killed. |
| 1514 | 1514 |
|
| 1515 | 1515 |
**Request Headers**: |
| 1516 | 1516 |
|
| 1517 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1517 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1518 | 1518 |
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON |
| 1519 | 1519 |
object with the following structure: |
| 1520 | 1520 |
|
| ... | ... |
@@ -1627,6 +1627,7 @@ Build an image from a Dockerfile |
| 1627 | 1627 |
**Example request**: |
| 1628 | 1628 |
|
| 1629 | 1629 |
POST /v1.22/build HTTP/1.1 |
| 1630 |
+ Content-Type: application/x-tar |
|
| 1630 | 1631 |
|
| 1631 | 1632 |
{% raw %}
|
| 1632 | 1633 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1694,7 +1695,7 @@ or being killed. |
| 1694 | 1694 |
|
| 1695 | 1695 |
**Request Headers**: |
| 1696 | 1696 |
|
| 1697 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1697 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1698 | 1698 |
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON |
| 1699 | 1699 |
object with the following structure: |
| 1700 | 1700 |
|
| ... | ... |
@@ -1662,6 +1662,7 @@ Build an image from a Dockerfile |
| 1662 | 1662 |
**Example request**: |
| 1663 | 1663 |
|
| 1664 | 1664 |
POST /v1.23/build HTTP/1.1 |
| 1665 |
+ Content-Type: application/x-tar |
|
| 1665 | 1666 |
|
| 1666 | 1667 |
{% raw %}
|
| 1667 | 1668 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1730,7 +1731,7 @@ or being killed. |
| 1730 | 1730 |
|
| 1731 | 1731 |
**Request Headers**: |
| 1732 | 1732 |
|
| 1733 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1733 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1734 | 1734 |
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON |
| 1735 | 1735 |
object with the following structure: |
| 1736 | 1736 |
|
| ... | ... |
@@ -1659,6 +1659,7 @@ Build an image from a Dockerfile |
| 1659 | 1659 |
**Example request**: |
| 1660 | 1660 |
|
| 1661 | 1661 |
POST /v1.24/build HTTP/1.1 |
| 1662 |
+ Content-Type: application/x-tar |
|
| 1662 | 1663 |
|
| 1663 | 1664 |
{% raw %}
|
| 1664 | 1665 |
{{ TAR STREAM }}
|
| ... | ... |
@@ -1727,7 +1728,7 @@ or being killed. |
| 1727 | 1727 |
|
| 1728 | 1728 |
**Request Headers**: |
| 1729 | 1729 |
|
| 1730 |
-- **Content-type** – Set to `"application/tar"`. |
|
| 1730 |
+- **Content-type** – Set to `"application/x-tar"`. |
|
| 1731 | 1731 |
- **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON |
| 1732 | 1732 |
object with the following structure: |
| 1733 | 1733 |
|
| ... | ... |
@@ -8,9 +8,8 @@ import ( |
| 8 | 8 |
// MimeTypes stores the MIME content type. |
| 9 | 9 |
var MimeTypes = struct {
|
| 10 | 10 |
TextPlain string |
| 11 |
- Tar string |
|
| 12 | 11 |
OctetStream string |
| 13 |
-}{"text/plain", "application/tar", "application/octet-stream"}
|
|
| 12 |
+}{"text/plain", "application/octet-stream"}
|
|
| 14 | 13 |
|
| 15 | 14 |
// DetectContentType returns a best guess representation of the MIME |
| 16 | 15 |
// content type for the bytes at c. The value detected by |