I'd like to propose adding pattern matching to some of the core classes of http, primarily deconstruct_keys, to allow for matching against things like Responses and Requests.
Consider:
response in {
status: 200..299,
body: /Header I want/
}
case response
in { status: 200..299, body: } then Success(body)
in { status: 300.., body: } then Failure(body)
else Failure('unknown')
end
This is just a theoretical example and may not be 100% accurate to the API, but I wanted to run things by the core team before implementing this as it ends up being a decent amount of additional code.
It should be noted that adding the interfaces (deconstruct and deconstruct_keys) will be backward compatible, but testing it with pattern matching will not be.
I'd like to propose adding pattern matching to some of the core classes of
http
, primarilydeconstruct_keys
, to allow for matching against things like Responses and Requests.Consider:
This is just a theoretical example and may not be 100% accurate to the API, but I wanted to run things by the core team before implementing this as it ends up being a decent amount of additional code.
It should be noted that adding the interfaces (
deconstruct
anddeconstruct_keys
) will be backward compatible, but testing it with pattern matching will not be.