Hello,
I’m testing endpoints that permit to write data throught POST requests. On success, these endpoint trigger an SSE notification on another endpoint.
Steps of my test are ::
Send the POST request
Validate basic assertions (like http status, response payload, etc)
Validate that we receive the SSE event on the second endpoint
Problems checking the SSE events:
For the third step I’m doing a GET on the second endpoint with pm.sendRequest but response is not retruned as a stream of events. It waits for the server to close SSE connection (30 seconds) before returning the complete answer (unparsed) :
pm.sendRequest('https://example.com/sse-endpoint', (error, response) => {
if (error) {
console.log(error);
} else {
console.log(response); // This is returned on connection close
}
});
Question:
How can I validate that I received a specific event without waiting for connection timeout every time I test an SSE endpoint ?
In other words: It looks like Postman does not permit to access the stream of events for an SSE request, am I right ?
Platform Details:
Version 10.19.14
UI Version: 10.19.14-ui-231031-0841
Desktop Platform Version: 10.19.7 (10.19.7)
On MacOS M2 14.0
Tags:
SSE, Streamed response, event stream