Closed TomLingham closed 1 year ago
@TomLingham This looks good and does not need an integration test. Could you make the minor change @maysam-tayyeb suggested? I will aim to merge and release this week.
Thanks, @AngelaE! I've updated this PR to include @maysam-tayyeb's feedback (thank you for merging the other PR, btw).
Thanks again, no rush on the release — we can wait. I appreciate the response 🙂
HTTP Responses in Mountebank allow the configuration of "text" or "binary" bodies via the
_mode
option. This is required to allow bodies to respond with a binary body (which can be specified by passing a response body encoded as base64). More information can be found on the Mountebank HTTP protocols page.This PR adds the ability to set the
_mode
value for a response in a backwards compatible way (despite"text"
being the default value, it doesn't set it unless it's explicitly set by the consumer).This doesn't add any additional QOL features for binary responses like base64 encoding a
Buffer
orUintNArray
via awithBinaryBody
method. More than happy to add that if you believe it is in the scope of this library to handle considering it does already have a similar QOL feature in thewithJSONBody
method.(also, have only added a unit test — it didn't seem to fit into the current integration test suite but happy to craft something for that also)