Closed jimonthebarn closed 6 months ago
In the meanwhile we could probably update the "code" generated when creating a Shell httpie request to also contain the --stream parameter in case of streaming responses. Othwise httpie buffers the data and will only output it once the response is completely received.
👍
Is there any update on this? I am currently facing this issue and wanted to know if there is any work around to deal with streams in Postman response.
I'm also looking for this capability for testing our streaming API with Postman alongside our other collections.
This feature would be useful for interacting with ksqlDB, which has a REST API endpoint for streaming queries
+1
+1 as it would be useful for interacting with ksqlDB.
+1
+1
+1
+1
+1
+1
+1
As workaround some scripting helps. I inserted the script of this stackoverflow-answer as Pre-request Script. Within the GET-Adress-bar I used an arbitrary page (google, health-endpoint, doesn't matter). Because I was testing publish/subscribe, I triggered additionally some URLs within Tests. The Console logged everything.
Basic setup:
Pre-request Script (https://stackoverflow.com/a/53934401/5029667):
// This timeout ensure that postman will not close the connection before completing async tasks.
// - it must be cleared once all tasks are completed or it will hang
const interval = setTimeout(() => {}, Number.MAX_SAFE_INTEGER);
let promiseNumber = 0;
function resolvedPromise() {
return new Promise((resolve, reject) => {
pm.sendRequest('https://domain.tld/subscribeToUser/karl' (err, res) => {
if (err) {
console.log(err);
reject();
} else {
console.log(`Resolved promise ${++promiseNumber}`);
resolve();
}
});
});
}
resolvedPromise()
.then(resolvedPromise)
.then(resolvedPromise)
.then(() => clearTimeout(interval))
.catch(err => {
console.log(err);
clearTimeout(interval);
});
Optionally issue scripts in the Tests-tab:
pm.sendRequest("https://domain.tld/sendToUser/karl/whoopwhoop1", function (err, response) {});
pm.sendRequest("https://domain.tld/sendToUser/karl/whoopwhoop2", function (err, response) {});
pm.sendRequest("https://domain.tld/sendToUser/karl/whoopwhoop3", function (err, response) {});
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
What is the team's current roadmap priority on tackling this?
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
Recommend cURL, to anyone that needs to test SSE, HTTP/1 chunked encoding, or HTTP/2 responses.
+1
+1
+10086
+10087
+1
+1
+1
+1
+1
With the advent of reactive streaming API's the handling of streamed responses becomes more and more important. Therefore I would love for postman to be able to handle streamed responses when setting the accept - header to application/stream+json or text/event-stream instead of the currently displayed 'Syntax error".
The response window could probably be updated when a new chunk of data comes in just like curl or httpie (with the --stream option) does. This probably needs a lot more thinking conceptually since it greatly differs from the way how responses are currently displayed in the response pane.
For the time being postman could wait for the stream to finish and output the result all at once just like httpie does when not started with the --stream parameter.
The alternative solution is currently to use curl or httpie which works but I'd love to be able to do this in my beloved postman. 😁