Comments (11)
@LukaGiorgadze Hi, I opened up #157 with two adjustments. I think it could be nice to even go a step further and deprecate the reply
method in favor of dedicated methods for each response type. It's straight forward for callbacks and async callbacks I guess, but for static JSON responses we could think about introducing a new sealed class like this here: dart-lang/language#83 (comment)
This would allow full typesafety for all cases of response variants. What do you think?
from http-mock-adapter.
@LukaGiorgadze Okay, I will try another PR separately with the Json
sealed class approach then.
For #157 I adjusted the unit tests (had to await the statusHandler
call because it's now a future for all cases), added two new cases (one for each new method), and regrouped the existing tests for the request handler. Do those changes make sense for you?
I saw that collection
was just upgraded to 1.18.0 a couple of days ago, so I had to manually pin the version on my test repo in order to use it. I'm currently using Flutter 3.10.5 and will soon upgrade to latest. I was creating the issue with http-mock-adapter
v0.4.4 and built the PR with v0.5.0.
Btw, what's up with the matcher section of the project? How can I make use of it? I would also like to add some documentation for new users of the project as I think the project is awesome and can help a lot of people.
from http-mock-adapter.
#157 has been merged
from http-mock-adapter.
Thanks @sebastianbuechler makes sense, currently I don't have to make this change, unfortunately, but you can make PR and I'll approve. Or I can address this in the future.
from http-mock-adapter.
Hi @sebastianbuechler, your proposal makes sense, I agree with that. Thank you!
Just make sure tests are passed since they are failing https://github.com/lomsa-dev/http-mock-adapter/actions/runs/5923116833/job/16058693248?pr=157
And will merge this.
I upgraded dependencies and upgraded the collection to 1.18.0 but since the stable version of Flutter still depends on an older version of the collection, I'll first downgrade the collection package and then release your changes with a major version since it might be a breaking change for some people.
btw, what version of Flutter and http-mock-adapter do you use?
from http-mock-adapter.
@sebastianbuechler Thank you Sebastian, updating the document makes really sense.
I'm thinking to downgrade the collection back, my gut feeling tells me Flutter stable is far away from upgrading the collection, so does it make sense to keep 1.18? I'm curious how it works for you.
from http-mock-adapter.
@LukaGiorgadze I have the same feeling that it still will take some time until will be useful. I don't see currently a reason to not downgrade, to be honest.
from http-mock-adapter.
@LukaGiorgadze I have the same feeling that it still will take some time until will be useful. I don't see currently a reason to not downgrade, to be honest
@sebastianbuechler Look at this #155
Did you face the same issue?
from http-mock-adapter.
@sebastianbuechler btw, I've invited you as a collaborator with write access.
from http-mock-adapter.
@LukaGiorgadze I have the same feeling that it still will take some time until will be useful. I don't see currently a reason to not downgrade, to be honest
@sebastianbuechler Look at this #155 Did you face the same issue?
Yes, exactly. I just set an override in my pubspec.yaml
:
dependency_overrides:
collection: ^1.17.1 # Temporary fix for http_mock_adapter
from http-mock-adapter.
@sebastianbuechler btw, I've invited you as a collaborator with write access.
Thanks you!
from http-mock-adapter.
Related Issues (20)
- can i request to onDownload when add unit test ? HOT 2
- [v0.4.0] collection version conflict between the v0.4.0 and flutter_test HOT 9
- Lower the Dart SDK constraint to 2.15.0
- Let server return different responses HOT 7
- FullHttpRequestMatcher: not identical data returns success response HOT 3
- Using query parameters in response data generation HOT 2
- use tester.pump rather than Future.delayed to allow tests to run faster HOT 1
- http_mock_adapter 0.5.0 conflicts with flutter_test collection version. HOT 8
- Async mocking not possible HOT 1
- Semantic release with github action HOT 2
- Add methods onDownload & onDownloadUri
- Library not compatible with flutter 3.16.0 - incorrect type definition HOT 3
- LDClient.get() was called before init()!
- Ability to mock whole API interface for local development without a need of a server. HOT 2
- Allow timeout simulations in replies HOT 2
- QUESTION: how to use dio.simpleGet HOT 2
- http_mock_adapter-0.4.4/lib/src/mixins/request_handling.dart:32:42: Error: A value of type 'FutureOr<List<int>>' can't be assigned to a variable of type 'List<int>'. HOT 1
- Latest registered callback is called when multiple HTTP methods have been mocked
- TypeError Occurs When Map Data and Headers are Set Together
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-mock-adapter.