Skip to content

Support multipart/form-data #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
felipejoribeiro opened this issue Oct 29, 2024 · 1 comment
Open
2 tasks done

Support multipart/form-data #487

felipejoribeiro opened this issue Oct 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@felipejoribeiro
Copy link

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.10.2

Operating system/version

OS: Arch Linux x86_64 | Kernel: 6.11.4-arch2-1

Actual behavior

When executing the following http request:

POST /v1/image/
HOST: http://localhost:8000
X-AUTH: {{TOKEN}}
Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="logo.png"
< /entire/path/to/file/logo.png
--WebAppBoundary--

I receive the following response:

### v1-auth#49
POST http://localhost:8000/v1/image/
HTTP/1.1 400 Bad Request

# @_RES (formatted)
{
  "detail": "Empty content"
}
# @_END

The reason is that the data of the request is going empty, as shown in the debugging session (the server is being implemented in Django btw):

image

But the request follows the jetbrains guidelines, so i'm not sure if its not supported.

Expected behavior

The request should send the file to the server in the data object. Which is postman's behavior.

Steps to reproduce

Run the base project with repro with nvim -u repro.lua and then run the following test file with :Repo run:

POST /v1/image/
HOST: http://localhost:8000
X-AUTH: XXXXXXX
Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="logo.png"
< /entire/path/to/file/logo.png
--WebAppBoundary--

Other information

rest.nvim package version:
version 3.8.3
tag v3.8.3
branch main
commit 113dce7

*ps: thanks for the great plugin. Best regards.

Repro (lazy.nvim)

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
    spec = {
        "rest-nvim/rest.nvim",
        {
            "nvim-treesitter/nvim-treesitter",
            build = ":TSUpdate",
            main = "nvim-treesitter.configs",
            opts = {
                ensure_installed = { "http" },
                sync_install = false,
                highlight = { enable = true },
                indent = { enable = true },
            },
        },
    },
})
@felipejoribeiro felipejoribeiro added the bug Something isn't working label Oct 29, 2024
@scav
Copy link

scav commented Jan 17, 2025

Based on this I assume this is not yet supported. I would love to see this supported as well, but my knowledge of Lua and plugins is very limited.

@boltlessengineer boltlessengineer added enhancement New feature or request and removed bug Something isn't working labels Feb 13, 2025
@boltlessengineer boltlessengineer changed the title Multipart/form-data not sending form data Support multipart/form-data Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants