Gabriël
Gabriël

Reputation: 1315

Using 'Any' instead of specific HTTP verb in ServiceStack

What are the advantages of using a specific HTTP verb instead of the 'Any' method in a ServiceStack.Service inherited implementation?

I understand you can change behaviour between the HTTP verbs if you want, but if you don't have this requirement is there any benefit of using a specific verb (i.e. GET/POST/PUT/DELETE).

Since we also you quite a lot of messages using MessagingService it seems to make sense to use Any, just to be sure.

Upvotes: 1

Views: 72

Answers (1)

mythz
mythz

Reputation: 143399

Using Any() is a preference on whether you want to Service available on any Verb or not, there's no real disadvantage to using it, but reasons you may not want to include:

  1. You want to control/limit how Consumers use your Service and
  2. Reduce conflicts when re-using the same route and distinguish calls by verb

My personal preference is to use Any() until I need to re-use the same route for different Services, at which point I'll switch to specific verbs.

Upvotes: 2

Related Questions