Jonathan Jonathan - 1 month ago 22
Dart Question

batch url execution with redstone

I am creating a rest api with redstone and dart.

Now I need to create a way to send several commands of the api in one POST.

Edit (@Pacane): Yes, the idea is to have one endpoint that can parse several commands within the api. Each command is another endpoint(Route) that can be accessed singularly within the API.

My question is how I can parse, executes the URLs and get the response for each URL using redstone.

I am thinking about using the unittest mock request and mock response. You can see here:

https://github.com/redstone-dart/redstone/wiki/Unit-test
Now I wonder if the mock request and response are different somehow from regular requests, if they use some analysis or something like it that would harm performance.

So, there are 2 questions:
1) is it ok to mock the redstone to parse several URLs?
2) if not, how could I do it?

thanks

Answer

I ended up using the MockRequest and MockResponse to achieve the batch commands. You can know more about it at the wiki: https://github.com/redstone-dart/redstone/wiki/Unit-test