-
Notifications
You must be signed in to change notification settings - Fork 76
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
Pass Headers from request #29
Comments
Currently there's no way to stub response headers, I'll try to sort this out as soon as I have some time. It could be the right time to change the interface of the stubbing request methods of SBTUITunneledApplication which require too many parameters for the default use cases (I have some ideas in mind). I'm usure whether it makes sense to introduce a forward feature for the header of the network request while stubbing the rest. Would adding a way to stub headers manually be enough for your use case? |
@tcamin for most of the scenarios adding the HTTP headers manually would be ok, but this would not work for HTTP endpoint that requires passing in auto generated tokens, If the project was in swift I could have tried to implement this, I hope if you get a chance can you have look into this issue, thanks again for a good tool |
I found some time to do the rewritings I had in mind. Funny enough during the process I realized that the headers could be already mocked in the previous implementation, so this confirms that doing the rework was truly necessary. 😀 As anticipated the 2.0 breaks compatibility with 1.x series, so you might want to check the brief (migration guide)[https://github.com/Subito-it/SBTUITestTunnel/tree/master/Documentation/Migration1to2.md]. I wasn't able to implement the headers forwarding as you requested, sorry for that. However I hope you'll enjoy the new stubbing syntax that really plays better with Swift. |
@tcamin thanks 👍 |
I can't seem to get the library to work on Requests that require an authorization header and I'm not clear from these threads as to whether this is possible, could you possibly clarify? |
Interacting with requests containing any type of headers shouldn’t be a problem whatsoever. If you’re experiencing a problem please open a new issue providing a sample project that replicates the issue and I’ll be more than willing to sort it out. |
Thanks for getting back to me so quickly. I figured out what my issue was. Creating a SBTStubResponse from an Array of Dictionaries fails as not proper JSON. Just a single Dictionary works though. Once I put my response into a separate formatted JSON file, it works. So nothing at all to do with the header ;) |
is it possible to support automatically passing in request headers to SBTUITunnel
i.e the app makes a request using the header/token
X-OTT-Agent
and SBTUITunnel uses those values automatically when mocking the network requestThe text was updated successfully, but these errors were encountered: