Open StachuDotNet opened 1 year ago
quick thoughts on making httpclient calls 'safe' and enabling a user to either
I suppose this is most similar to having a DB-accessing function take a DbRef
first, note that URLs look roughly like:
so, define some types like
type SchemeRule =
| AnyScheme
| SpecificScheme of string
type AuthorityRule =
| AnyAuthority
| SpecificDomain of string
| AnySubdomainOf of string
type PathRule =
| AnyPath
| StartsWith of string
| EqualsTo of string
type QueryRule =
| AnyQuery
| ContainsKey of string
| KeyValue of string * string
type FragmentRule =
| AnyFragment
| FragmentEquals of string
type UrlRule = {
Scheme: SchemeRule
Authority: AuthorityRule
Path: PathRule
Query: QueryRule
Fragment: FragmentRule
}
let exampleUsage = {
Scheme = SpecificScheme "https"
Authority = AnySubdomainOf "google.com"
Path = AnyPath
Query = AnyQuery
Fragment = AnyFragment
}
and from there, it feels like there are a few ways to use those types to provide info/security:
UrlRule
value, along with the url to call, and validate before calling
let httpClient (rules: UrlRule) (url: string): HttpClientResult = ...
Dark avails a base Http client, for making calls to endpoints across the internet. This issue organies varios improvements to, and testing of, the HttpClient and its surrounding helper functions.
These tasks are largely unblocked, and accessible to anyone interested.
This needs notable organization, clearly.
SocketsHttpHandler
propertiesHttpMessageHandler
propertiesHttpClient::[x]_v5
tests::request
's parameters.test
files to the mainhttpbaseclient.tests
fileconnect
?content-type
header withbody
, etc.)