You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the user uses a .har file that contained a resource with a 304 status , this package will throw an exception:
Uncaught (in promise) TypeError: Failed to construct 'Response': Response with null body status cannot have body
at toResponse (@mswjs_source_traffic.js)
at fromTraffic (@mswjs_source_traffic.js)
// Happen when the resource is already in cache
it.todo(
'does not throw an exception given an HAR file with a 304 status entry',
() => {
const traffic = readArchive(
'test/traffic/fixtures/archives/entry-with-status-304.har',
)
expect(() => fromTraffic(traffic)).not.toThrow()
},
)
Expected behavior
It would be ideal if the library didn't throw an exception, or if we could add an entry in the documentation advising users to clear the cache before generating the HAR file to avoid this issue.
Initial assessment
Browsers, despite the specification stating that a 304 Not Modified response should not include a response body, might display a response body in the network tab for a few practical reasons related to implementation details, user experience, and debugging purposes. These responses do end up in the HAR file.
The text was updated successfully, but these errors were encountered:
Description
If the user uses a .har file that contained a resource with a 304 status , this package will throw an exception:
https://github.com/mswjs/source/blob/main/src/traffic/utils/har-utils.ts#L40
Reproduction steps
Go to your favorite website, ie: https://source.mswjs.io/
Make sure
Disable cache
is not checked in the network tabClean the network log and refresh
The document and some resources should have a 304 status
Export the logs as HAR file
Try to generate the request handlers following the instructions
HAR file
test/traffic/fixtures/archives/entry-with-status-304.har
Test template
Expected behavior
It would be ideal if the library didn't throw an exception, or if we could add an entry in the documentation advising users to clear the cache before generating the HAR file to avoid this issue.
Initial assessment
Browsers, despite the specification stating that a 304 Not Modified response should not include a response body, might display a response body in the network tab for a few practical reasons related to implementation details, user experience, and debugging purposes. These responses do end up in the HAR file.
The text was updated successfully, but these errors were encountered: