forked from mtusi2026/mtusi2026lab4
Доплнен отчет
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Optional HTTP-client worksheet; no extension is required by the course.
|
||||
# Replace IDs/token locally from real responses; do not commit filled-in credentials.
|
||||
# Canonical API: contracts/openapi.json and contracts/README.md.
|
||||
@baseUrl = http://localhost:8080
|
||||
@aliceId = REPLACE_WITH_CREATED_ALICE_UUID
|
||||
@bobId = REPLACE_WITH_CREATED_BOB_UUID
|
||||
@chatId = REPLACE_WITH_CREATED_CHAT_UUID
|
||||
@sessionToken = REPLACE_LOCALLY_DO_NOT_COMMIT
|
||||
|
||||
### Liveness
|
||||
GET {{baseUrl}}/health/live
|
||||
|
||||
### Register Alice (repeat with username bob/display_name Боб)
|
||||
POST {{baseUrl}}/api/v1/users
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"username": "alice",
|
||||
"display_name": "Алиса",
|
||||
"password": "Example-only-not-a-real-secret-123"
|
||||
}
|
||||
|
||||
### Create session with Basic; the HTTP client encodes UTF-8 credentials
|
||||
POST {{baseUrl}}/api/v1/auth/sessions
|
||||
Authorization: Basic admin admin-password-123
|
||||
|
||||
### Create chat; both UUIDs must be real registered users
|
||||
POST {{baseUrl}}/api/v1/chats
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{"title":"Проект по ВНП","member_ids":["{{aliceId}}","{{bobId}}"]}
|
||||
|
||||
### Send message
|
||||
POST {{baseUrl}}/api/v1/chats/{{chatId}}/messages
|
||||
Idempotency-Key: {{$uuid}}
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
{"text":"Привет, Боб!"}
|
||||
|
||||
### Read first page
|
||||
GET {{baseUrl}}/api/v1/chats/{{chatId}}/messages?limit=50
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
|
||||
### Lab4: upload one original PNG (raw body, not multipart)
|
||||
POST {{baseUrl}}/api/v1/chats/{{chatId}}/attachments?filename=sample.png
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
Content-Type: image/png
|
||||
|
||||
< ../tests/fixtures/sample.png
|
||||
|
||||
### Lab4: replace attachmentId with the UUID from the upload response
|
||||
@attachmentId = REPLACE_WITH_UPLOADED_ATTACHMENT_UUID
|
||||
GET {{baseUrl}}/api/v1/attachments/{{attachmentId}}
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
|
||||
### Lab4: message with an image and no caption; use a fresh key for a new message
|
||||
POST {{baseUrl}}/api/v1/chats/{{chatId}}/messages
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
Content-Type: application/json
|
||||
Idempotency-Key: lab4-image-example-001
|
||||
|
||||
{"text":"","attachment_ids":["{{attachmentId}}"]}
|
||||
|
||||
### Lab4: original bytes through authorized API
|
||||
GET {{baseUrl}}/api/v1/attachments/{{attachmentId}}/content
|
||||
Authorization: Bearer {{sessionToken}}
|
||||
Reference in New Issue
Block a user