upload authorization. More examples, fix some typo

This commit is contained in:
quentintaranpino 2024-09-12 09:35:07 +02:00
parent 00a378d81f
commit 86d8da4870
1 changed files with 23 additions and 1 deletions

View File

@ -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-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
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
```
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:
@ -44,6 +51,21 @@ HTTP/1.1 400 Bad Request
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/1.1 413 Content Too Large
X-Upload-Message: File too large. Max allowed size is 100MB