-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature: session handling #44
base: master
Are you sure you want to change the base?
Conversation
Manage regex as path ldabiralai#39
Ability to mock using regexs
c3f96c8
to
8ab5b45
Compare
@harijoe I've had a look at your PR and it sounds like a cool idea that you could have sessions with different mocks in them. I'm currently working on a version 3 of Simulado ( Which is basically a total rewrite ). I'd be keen to take what you've done and port it over to v3. Just one question: How does the session Id get managed? Is that the clients job to do that or is that the job of simulado to manage that? Personally I think it would be the responsibility of the client to manage it's own session and pass that to simulado. |
Thanks @harijoe, sorry this has taken a while to be looked into. Just one question/thought. Ideally Let's imagine that we have two tests simultaneously running using different sessions, as implemented here. The first test finishes and calls I'm not totally sure how we can get around this issue without adding further complexity around having My initial thought regarding this feature was to spin up a new simulado in the before hook of your test, test against it and then spin it down after? Obviously this moves a bit more complexity to the more advanced consumer, so I'm more than willing to consider alternatives! |
I talked with @harijoe about this and the general idea was to get the client to generate the session id themselves. |
The solution is simple: you would call |
@harijoe the PR looks messed up and needs rebasing to remove the erroneous commits (we should not be able to see @vlebadezet and @ldabiralai commits here) 😉 |
@bdo Ok, I think the client handling the So if the client handles the |
Ahh yes.. sorry, I was just putting thoughts out there while on the train so didn't see the PR accounted for this already.. 😄 I'll have a look at getting this PR (or a similar version of it) into both v2 & v3 tonight.
This should work, I'm not sure how easy it would be for the client to handle injecting that into each request though, but I guess it's the only option aside from splitting tests across multiple machines. |
An alternative to this is to respond to a cookie, as it's a fair bit easier to set these during browser tests (as you wouldn't need to modify the actual code to inject a header), this is how this PR is implemented. The downside of that is the cross domain issues, meaning that simulado would have to run on the same hostname as the app making requests, would this be practical? |
I think we can live with a cookie to start with. We may want to open an issue later to address this concern. The If you want to go for both cookie or header in the initial PR I'm OK with that as well 👍 |
No description provided.