Doing a POST with URLSearchParams as body, I noticed I got the same data back for all requests. Turned out that the JSON.stringify( ) just skips the body all together.
I solved this by checking if the body property is an object, and if so, I use the toString( ) representation as input to the hash-function. Either this will return the default [object object] representation, which is neither better nor worse than current behavior, or it will return a better representation like in the case of URLSearchParams.
Doing a POST with
URLSearchParams
as body, I noticed I got the same data back for all requests. Turned out that theJSON.stringify( )
just skips the body all together.I solved this by checking if the body property is an object, and if so, I use the toString( ) representation as input to the hash-function. Either this will return the default
[object object]
representation, which is neither better nor worse than current behavior, or it will return a better representation like in the case ofURLSearchParams
.