NoamGaash / playwright-advanced-har

MIT License
27 stars 0 forks source link

add REST scoring function #3

Open NoamGaash opened 11 months ago

NoamGaash commented 11 months ago

Goal

when the user makes several requests to the same resource, we want to distinguish state altering requests from read only request, and replay the requests in the right order. for example: GET api/status returns {"count": 123} GET api/status returns {"count": 123} POST api/status with body {"count": 456} returns {"saved": true} GET api/status returns {"count": 456}

when recording and when replaying, we want to achieve the same behavior.

usage:

    await advancedRouteFromHAR(/\/(api)|(bff)\//, {
        matcher: baseMatcher({
            scoring: restScoring
        })
    });