Skip to content

Kulala Formatter deletes multipart form-data request bodies #53

@jshumway

Description

@jshumway

The formatter deletes the request body when specifying multipart form data, e.g., using this recipe from the wiki: https://neovim.getkulala.net/docs/usage/recipes#uploading-a-file

$ cat ~/example.http

@content_type = image/jpeg
@filename = logo.png
@filepath = ../../assets/badge-discord.svg


###

POST https://httpbin.org/post HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary{{$timestamp}}

------WebKitFormBoundary{{$timestamp}}
Content-Disposition: form-data; name="file"; filename="{{filename}}"
Content-Type: {{content_type}}

< {{filepath}}

------WebKitFormBoundary{{$timestamp}}--

$ cat ~/example.http | kulata-fmt --stdin

@content_type = image/jpeg
@filename = logo.png
@filepath = ../../assets/badge-discord.svg


###

POST https://httpbin.org/post HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary{{$timestamp}}

The same happens when running in Neovim via conform, but I wanted to provide the above to show it happens without any of the Neovim/conform machinery in the mix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions