mirror of
https://github.com/hzrd149/blossom.git
synced 2025-12-08 22:58:51 +00:00
upload authorization. More examples, fix some typo
This commit is contained in:
24
buds/06.md
24
buds/06.md
@@ -19,6 +19,12 @@ The `HEAD /upload` endpoint `MUST` use the `Content-Digest`, `X-Content-Type` an
|
|||||||
- `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 fblobile'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.
|
- `X-Upload-Message`: A human readable message that explains the reason why the upload cannot proceed.
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|
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
|
### Examples
|
||||||
|
|
||||||
Example request from the client:
|
Example request from the client:
|
||||||
@@ -35,7 +41,8 @@ Example response from the server if the upload can be done:
|
|||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
```
|
```
|
||||||
|
|
||||||
If the upload cannot proceed, the server `MUST` return an appropriate 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:
|
Some examples of error messages:
|
||||||
|
|
||||||
@@ -44,6 +51,21 @@ HTTP/1.1 400 Bad Request
|
|||||||
X-Upload-Message: Invalid Content-Digest header format. Expected format: sha-256=:<hash>:
|
X-Upload-Message: Invalid Content-Digest header format. Expected format: sha-256=:<hash>:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```http
|
||||||
|
HTTP/1.1 401 Unauthorized
|
||||||
|
X-Upload-Message: Authorization required for uploading video files
|
||||||
|
```
|
||||||
|
|
||||||
|
```http
|
||||||
|
HTTP/1.1 401 Forbidden
|
||||||
|
X-Upload-Message: Account banned
|
||||||
|
```
|
||||||
|
|
||||||
|
```http
|
||||||
|
HTTP/1.1 411 Length Required
|
||||||
|
X-Upload-Message: Missing Content-Length or X-Content-Length headers
|
||||||
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 413 Content Too Large
|
HTTP/1.1 413 Content Too Large
|
||||||
X-Upload-Message: File too large. Max allowed size is 100MB
|
X-Upload-Message: File too large. Max allowed size is 100MB
|
||||||
|
|||||||
Reference in New Issue
Block a user