Respuestas en streaming
Respuestas en streaming: Server-Sent Events, NDJSON, transferencia chunked, goteo de bytes y un array JSON en streaming. El buffering de respuestas está desactivado y cada evento se envía al momento, así que los clientes ven los datos según se producen. Cada stream se detiene en cuanto el 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.
Petición de ejemplo
Drip bytes slowly over a duration. Referencia completa y botón Send (en inglés).
cURL
curl -X GET "https://api.testingapis.com/api/stream/drip?durationMs=500&bytes=5"Respuesta · 200 OK
<binary body: 5 bytes, application/octet-stream>