mirror of https://github.com/hzrd149/blossom.git
parent
2d392c1f58
commit
f27cd777f2
25
buds/06.md
25
buds/06.md
|
@ -1,8 +1,6 @@
|
|||
BUD-06
|
||||
======
|
||||
# BUD-06
|
||||
|
||||
Upload requirements
|
||||
---------------
|
||||
## Upload requirements
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
|
@ -16,14 +14,14 @@ The `HEAD /upload` endpoint `MUST` use the `X-SHA-256`, `X-Content-Type` and `X-
|
|||
|
||||
- `X-SHA-256`: A string that represents the blob's SHA-256 hash.
|
||||
- `X-Content-Length`: An integer that represents the blob size in bytes.
|
||||
- `X-Content-Type`: A string that specifies the fblobile's MIME type, like `application/pdf` or `image/png`.
|
||||
- `X-Content-Type`: A string that specifies the blob's MIME type, like `application/pdf` or `image/png`.
|
||||
- `X-Upload-Message`: A human readable message that explains the reason why the upload cannot proceed.
|
||||
|
||||
### Upload Authorization
|
||||
### Upload Authorization
|
||||
|
||||
The `HEAD /upload` endpoint MAY accept an `upload` authorization event using the `Authorization` header similar to what is used in the [`PUT /upload`](./02.md#upload-authorization-required) endpoint
|
||||
The `HEAD /upload` endpoint MAY accept an `upload` authorization event using the `Authorization` header similar to what is used in the [`PUT /upload`](./02.md#upload-authorization-required) endpoint
|
||||
|
||||
If the server requires authorization to upload it may respond with the `401` status code, or if authorization was provided and is invalid or not permitted it may respond with `403` status code
|
||||
If the server requires authorization to upload it may respond with the `401` status code, or if authorization was provided and is invalid or not permitted it may respond with `403` status code
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -41,8 +39,7 @@ Example response from the server if the upload can be done:
|
|||
HTTP/1.1 200 OK
|
||||
```
|
||||
|
||||
If the upload cannot proceed, the server `MUST` return an appropriate `4xx` HTTP status code and a custom header `X-Upload-Message` with a human readable error message.
|
||||
|
||||
If the upload cannot proceed, the server `MUST` return an appropriate `4xx` HTTP status code and a custom header `X-Upload-Message` with a human readable error message.
|
||||
|
||||
Some examples of error messages:
|
||||
|
||||
|
@ -52,17 +49,17 @@ X-Upload-Message: Invalid X-SHA-256 header format. Expected a string.
|
|||
```
|
||||
|
||||
```http
|
||||
HTTP/1.1 401 Unauthorized
|
||||
HTTP/1.1 401 Unauthorized
|
||||
X-Upload-Message: Authorization required for uploading video files.
|
||||
```
|
||||
|
||||
```http
|
||||
HTTP/1.1 403 Forbidden
|
||||
HTTP/1.1 403 Forbidden
|
||||
X-Upload-Message: SHA-256 hash banned.
|
||||
```
|
||||
|
||||
```http
|
||||
HTTP/1.1 411 Length Required
|
||||
HTTP/1.1 411 Length Required
|
||||
X-Upload-Message: Missing X-Content-Length header.
|
||||
```
|
||||
|
||||
|
@ -74,4 +71,4 @@ X-Upload-Message: File too large. Max allowed size is 100MB.
|
|||
```http
|
||||
HTTP/1.1 415 Unsupported Media Type
|
||||
X-Upload-Message: Unsupported file type.
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue