Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different Responses to the same URI based on the passed data #41

Open
mhaseebkhan opened this issue Aug 26, 2013 · 2 comments
Open

Different Responses to the same URI based on the passed data #41

mhaseebkhan opened this issue Aug 26, 2013 · 2 comments

Comments

@mhaseebkhan
Copy link

I am working on a project using fakeweb. Found it to be useful. :)

I have a scenario in which I need to return different responses based on the data passed in the request on the same URI. Example below:

FakeWeb.register_uri(:post,
                           %r{http:\/\/api.flickr.com\/services\/rest\/},
                           parameters: {method: 'flickr.reflection.getMethods', format: 'json', nojsoncallback: "1"},
                           body: "First Content")

# Should return First Content

FakeWeb.register_uri(:post,
                           %r{http:\/\/api.flickr.com\/services\/rest\/},
                           parameters: {method: 'flickr.photos.getRecent', format: 'json', nojsoncallback: "1"},
                           body: "Second Content")

# Should return Second Content

In the case above, the URI is the same, however, the values of the parameters are different.

How this can be achieved?

@drunkonsound
Copy link

It doesn't look like this functionality is currently present, I also need this feature and haven't yet found a solution.

@ajay-vmware
Copy link

They support rotating responses but that too doesn't seem to work. It always responds with first registered response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants