dave
04/22/2018, 6:19 AMRoutingHttpHandler is actually a combination of a Router and an HttpHandler. The Router match() method is designed to provide an HttpHandler which can service the Request. If it can't, it returns null. Although it is on the public API, it isn't really something that we expect people to have to worry about TBH - if you're attempting to define your own over and above the ones that are already there, then that would seem to be pretty advanced usage of the API. 🙂
- Body.length can throw an exception because we don't always know it - the option there was to internalise the content and return null, but the exception only happens if you've activated streaming - which could end up in some rather nasty behaviour (crash due to OOM), so we decided to throw instead because it's safer.
- Body isn't a sealed class because there are other implementations (MultipartFormBody)