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

Pass Headers from request #29

Closed
Ashraf-Ali-aa opened this issue May 20, 2017 · 7 comments
Closed

Pass Headers from request #29

Ashraf-Ali-aa opened this issue May 20, 2017 · 7 comments

Comments

@Ashraf-Ali-aa
Copy link
Contributor

Ashraf-Ali-aa commented May 20, 2017

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 request

@tcamin
Copy link
Member

tcamin commented May 21, 2017

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?

@Ashraf-Ali-aa
Copy link
Contributor Author

Ashraf-Ali-aa commented May 22, 2017

@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

@tcamin
Copy link
Member

tcamin commented May 24, 2017

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.

@Ashraf-Ali-aa
Copy link
Contributor Author

@tcamin thanks 👍

@tcamin tcamin closed this as completed May 25, 2017
@ghost
Copy link

ghost commented Feb 1, 2018

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?

@tcamin tcamin reopened this Feb 1, 2018
@tcamin
Copy link
Member

tcamin commented Feb 1, 2018

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.

@ghost
Copy link

ghost commented Feb 1, 2018

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 ;)

@tcamin tcamin closed this as completed Feb 1, 2018
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

2 participants