Comments (3)
@prewk
This package supports
Supports both named parameters (/:foo/:bar) and query parameters(/foo?bar=true)
You can easily achieve this by passing query parameters with any value. This package won't check the value of the params but check the keys to match.
/api/foos?skip=anything&limit=anything&dir=anything&sort=anything
The above should work for you. then you can modify the response with your desired value.
from storybook-addon-mock.
Ahh I misinterpreted the instructions, thanks a lot!
from storybook-addon-mock.
I've got a question related to this: how to use wildcards in more complex (dynamic) URLs? I'm trying to intersect/mock a URL sent to Google Maps API, which looks like this:
https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictionsJson?1sQUERIED_STRING&4sen-CA&15e3&21m1&2e1&callback=_xdc_._amopoh&key=API_KEY&token=12345
As you can see, these are not simple query params, like ?bar=foo
. Instead, the param key is dynamic: in the example above the first param's key is 1sQUERIED_STRING_1
and if I were to query "xyz". it would be 1sxyz
. It also doesn't have the =
sign. The same case is with the second param.
PS. I might be misinterpreting the params, and the first key is everything until the first =
sign, which would mean that the first param (key/value) is 1sQUERIED_STRING&4sen-CA&15e3&21m1&2e1&callback=_xdc_._amopoh
, but that still makes the key dynamic, since QUERIED_STRING
will be different based on user input.
from storybook-addon-mock.
Related Issues (20)
- URL params order shouldn't matter
- [Feature] Should be able to abort fetch requests HOT 1
- XMLHttpRequest is not properly reflected when there's no mock matched HOT 12
- Scope mockData to each story
- Addon fails in Yarn pnp projects HOT 3
- getting blank pages when navigating around storybook after adding the mock addon HOT 3
- `forEach` and other properties missing from response headers HOT 3
- Not properly mocking requests made with ofetch HOT 2
- Undeclared dependency on `prop-types` HOT 1
- No apparent way to mock NextJs internal API calls
- panel content not scrollable HOT 3
- Support string responses
- Unable to `ignoreQueryParams` per request basis HOT 1
- Disabling the addon for specific story causes an error
- Problem with mocking N requests of one type [GET]. HOT 1
- Enabling this addon interferes with `vue-advanced-cropper`
- Storybook 8 compatibility HOT 13
- Mocking SVG Get Request
- error after updating to storybook 8 HOT 1
- Support for differentiating URL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook-addon-mock.