fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
814 stars 288 forks source link

HTTP - No need extra newline before the endBoundaryStream in writeMultipart #1420

Closed kphuanghk closed 2 years ago

kphuanghk commented 2 years ago

Regarding #1397 , after introduced newline in MultipartItem stream construction. It should no longer need to have newline before the endBoundaryStream . This will cause extra 2 bytes "/r/n" to the last multipart item.

Original:

        let wholePayload = Seq.append segments [newlineStream(); endBoundaryStream; ]

Shall be:

        /// per spec, close-delimiter := "--" boundary "--" CRLF ; no need extra newline
        let wholePayload = Seq.append segments [ endBoundaryStream; ]

Here's the skeleton program I used to test the two extra bytes issue: TestProgram.fs.MD

For those affected by this issue, just need to remove extra two bytes for the affected files.

cartermp commented 2 years ago

Addressed in https://github.com/fsprojects/FSharp.Data/pull/1421