Respostas em streaming
Respostas em streaming: Server-Sent Events, NDJSON, transferência chunked, gotejamento de bytes e um array JSON em streaming. O buffering das respostas está desligado e cada evento é enviado na hora, então os clientes veem os dados à medida que são produzidos. Todo stream para assim que o cliente se desconecta.
- GET
https://api.testingapis.com/api/stream/chunked/{n}Send a plain-text response in chunked transfer encoding. - GET
https://api.testingapis.com/api/stream/dripDrip bytes slowly over a duration. - GET
https://api.testingapis.com/api/stream/json-array/{n}Stream a JSON array one element at a time. - GET
https://api.testingapis.com/api/stream/ndjson/{n}Stream newline-delimited JSON, one object per line. - GET
https://api.testingapis.com/api/stream/sseStream Server-Sent Events. - GET
https://api.testingapis.com/api/stream/sse/stockStream a deterministic stock ticker as Server-Sent Events.
Requisição de exemplo
Drip bytes slowly over a duration. Referência completa e botão Send (em inglês).
cURL
curl -X GET "https://api.testingapis.com/api/stream/drip?durationMs=500&bytes=5"Resposta · 200 OK
<binary body: 5 bytes, application/octet-stream>