Add support for multipart responses. Work in progress.

Feels like we have some duplicated logic here. Is there any way we could simplify this and still archive the same result?