Coder Social home page Coder Social logo

Comments (3)

nutboltu avatar nutboltu commented on September 17, 2024

@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.

prewk avatar prewk commented on September 17, 2024

Ahh I misinterpreted the instructions, thanks a lot!

from storybook-addon-mock.

nad182 avatar nad182 commented on September 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.