curl parameters size limit

Open
#608 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
lua
Domain
networking

Research direction

Start at the plenary.curl entry point used by curl.post and reproduce the error with progressively larger request bodies. Trace where the "value too large" error originates, then document the effective limit or identify the change needed to support larger bodies.

Written by the indexing model from the issue text.

Description

Hello,

With the below code, If the body is very big, I get a "value too large" error.
After having put logging everywhere, I found that the error is thrown at the curl.post line, when the body is past to plenary.curl.
I think that there is a size limit for the body, but I don't know how where is that limit set.
What is exactly the limit?

local curl = require('plenary.curl')
local query = {}

function query.askCallback(res, opts)
  -- Process res and opts
end

function query.ask(instruction, prompt, opts, api_key)
  local url = 'https://generativelanguage.googleapis.com'
  local path = '/v1beta/models/gemini-1.5-pro-latest:generateContent'
  curl.post(url .. path,
    {
      headers = {
        ['Content-type'] = 'application/json',
        ['x-goog-api-key'] = api_key
      },
      body = json.encode(
        {
          -- Big, very big body
        }),
      callback = function(res)
        vim.schedule(function() query.askCallback(res, opts) end)
      end
    })
end

return query
Dominant language
Lua
Stars
3.5k
Forks
340
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvim-lua/plenary.nvim

All issues in nvim-lua/plenary.nvim

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.