multipart-kit
multipart-kit copied to clipboard
Add encoding function that returns Data. Fixes #94
Added encodeToData
function to FormDataEncoder
which returns Data instead of String.
Added serializeToData
function to MultipartSerializer
which returns Data instead of String.
Added decode
function to FormDataDecoder
which accepts Data as input.
Added test for encoding and decoding a jpeg image with the new Data functions.
Added test for encoding and decoding a jpeg image with the original String functions.
Added image.jpeg in /Utilities
This PR fixes https://github.com/vapor/multipart-kit/issues/94
Thank you for your fast feedback! Hopefully I covered everything - please let me know if not or if you have any further comments.
@andrew804 Looks like this is failing in CI
@0xTim the failing test is the one that tests for encoding and decoding a jpeg image with the original string functions which highlights the original bug ie the original bug is still present, using the string encoding and decoding functions still corrupts the data.
Therefore I could either 1) add a warning in the documentation to not use the string functions and instead use the data functions for encoding and decoding images, then just remove the failing test or 2) remove the troublesome string functions entirely and include this PR in the next major release.
Unless you have any other suggestion, what would you prefer?