Betterment/charlatan

CharlatanResponseBuilder type-safety breaking change proposal

Closed this issue · 0 comments

I think we could make a breaking change to make things more typesafe

whenDelete(
  '/users',
  charlatanResponseWith({'id': 123}, status: 200),
);

where charlatanResponseWith returns a CharlatanResponseBuilder that produces a json response with a 200 status code. then if you wanna do something fancier, you drop down to defining your own builder but we change it to require the builder to return a CharlatanHttpResponse instead of Object?. as a reminder, the reason it expects Object? right now is to support returning just a Map from the builder in the normal case where you want a 200 with a json body.

Originally posted by @samandmoore in #23 (comment)