0

I'm trying to use Siesta for sending POST request with multiple url parameters.

The problem is even though the solution is presented here, it only shows example for a single parameter. So my question is, is there any other ways to add multiple parameters or should I just use the withParam() multiple times?

E.g. .withParam("myparam", "1").withParam("myparam2", "1").withParam("myparam3", "1")...

I'm asking because using withParam() multiple times kinda look messy although it works =)

Community
  • 1
  • 1
Dan
  • 810
  • 2
  • 11
  • 29

1 Answers1

1

You’ve answered your own question: withParam is chainable, and that is the correct way to add multiple params.

It’s quite possible to format it in a tidy way, as in this snippet from the example project:

var activeRepositories: Resource {
    return service
        .resource("/search/repositories")
        .withParam("q", "stars:>0")
        .withParam("sort", "updated")
        .withParam("order", "desc")
}

I would welcome a feature request for a flavor that takes a dictionary if you or others think that would be useful.

Paul Cantrell
  • 9,175
  • 2
  • 40
  • 48