The Http
type is a static class, because it's stateless, so it doesn't make sense to inherit from it. If you want to use cookies and maintain them across requests, you can just create a CookieContainer
and reuse it across requests:
let cc = CookieContainer()
Http.RequestString("url1", cookieContainer = cc)
Http.RequestString("url2", cookieContainer = cc)
If you really want to, you can create a wrapper for it like this:
type HttpWithState() =
let cookies = CookieContainer()
static member RequestString(url, ?params, ?headers, ...) =
Http.RequestString(url, ?params = params, ?headers = headers, ..., cookieContainer = cookies)
and then use it like this:
let http = HttpWithState()
http.RequestString("url1")
http.RequestString("url2")
But you won't gain that much over using the Http
type directly