Add query param parsing for URLs with the same pathname
This release includes new features, including:
- Query parameter parsing! The function to dynamically update responses can now read query parameters passed in the async request. The new signature is
dynamicResponseModFn(request, response, queryParamMap)
. This also includes content passed in the URL hash, stored in thequeryParamMap.hash
field. - Relatedly, you can now optionally treat all URLs with the same pathname identically, such that the same
dynamicResponseModFn()
function can generate different responses based on the query parameter values. For example, the dynamic modification function forexample.com/search
can handle all queries passed toexample.com/search?q=[searchQuery]
. Simply set theMockResponseConfig.usePathnameForAllQueries
totrue
to activate this feature. - New utility function,
mapStaticConfigToDynamic(staticConfig)
, to easily convert your static URL-response mock configurations to their dynamic counterparts. See the ReadMe/demo for sample usages.