Flipper: Discussion: Network plugin response mocking

Created on 3 Jul 2019  路  5Comments  路  Source: facebook/flipper

Hi everyone,

I am thinking of a new feature for network plugin, to perform network response mocking right inside Flipper. It will bring convenience to developers when they want to use mock data in the app when the backend service is not yet ready.

I have written a simple POC, and this is how it looks.

2019-07-03 06 06 12

It is still WIP, and only supports Android / okhttp at this moment. you can find the code in my forked repo https://github.com/qichuan/flipper/tree/network_mock

if you think it is a good idea and want to turn this POC into a real product, some bits of help is needed here

  • Fix the React performance issue in the Response headers tab
  • iOS support
  • Anything else that you think it can be better
Android Stale enhancement

Most helpful comment

It looks that existing request mocking doesn't support http status mocking, only headers and body, which is quite big limitation, testing exception is one of the most important features of request mocking

All 5 comments

Love this!

I had actually started implementing something very similar myself, but yours looks more polished. I especially like how you've highlighted the rows containing mocked data.

I would suggest getting a minimal working version complete, and then adding any other additional features afterwards.

Feel free to ship it with only Android support to start with, we can use the supportsMethod call to check whether the current client supports mocking, and gracefully not show the feature when it doesn't. This will also take care of backwards compatibility with the network plugin.
https://github.com/facebook/flipper/blob/master/src/plugin.js#L39

I'm not sure what react performance issue you're talking about though.

I am glad that you like it :)

Let me do some touch-ups and will create a PR for Android implementation first.

Hi @jknoxville The PR is ready at https://github.com/facebook/flipper/pull/488

However, the build failed due to The command "pod install --silent" failed and exited with 1 during . Can you please take a look? Thanks

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

It looks that existing request mocking doesn't support http status mocking, only headers and body, which is quite big limitation, testing exception is one of the most important features of request mocking

Was this page helpful?
0 / 5 - 0 ratings