Skip to content

Add query param parsing for URLs with the same pathname

Compare
Choose a tag to compare
@D-Pow D-Pow released this 21 Oct 02:30
· 356 commits to master since this release

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 the queryParamMap.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 for example.com/search can handle all queries passed to example.com/search?q=[searchQuery]. Simply set the MockResponseConfig.usePathnameForAllQueries to true 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.