Domanda

I have an application that will be consuming several REST APIs by a number of third parties and I am tossing up between using HttpClient and ServiceStack.Client to consume them.

I'd love to stay unified and use ServiceStack.Client, but I'm not sure if it's targeted more to support the patterns & practices of a ServiceStack REST API or whether it is flexible enough to be used to consume any arbitrary HTTP REST API.

Specifically, the APIs I am consuming have their own custom authentication methods (not basic or digest etc) and require the client to accept cookies. Is ServiceStack.Client appropriate to use in these scenarios?

È stato utile?

Soluzione

Following on from what @mythz said, I ended up using the ServiceStack HTTP Utils library.

To handle cookies and custom authentication requirements, I hooked the 'requestFilter' parameter that is available in most of the extension methods, to manipulate the post's header prior to it being sent. It's just a simple Action.

It's covered my needs quite well and been quite elegant.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top