1

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

Jonathan
  • 4,724
  • 7
  • 45
  • 65
  • Sorry, I'm not sure what you mean by "Now I need to create a way to send several commands of the api in one POST." Is it that you need 1 http request to hit multiple end points? If so, I don't think it's currently possible. However a possible workaround would be to create a specific end point that delegates to other redstone handlers. – Pacane Oct 26 '16 at 17:28
  • Yes @Pacane, the idea is to have one endpoint to parse several commands. How could I create the redstone handlers that you mentioned? – Jonathan Oct 26 '16 at 17:34

1 Answers1

0

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

Jonathan
  • 4,724
  • 7
  • 45
  • 65