openresty / openresty/lua-nginx-module

File Format Change from csv to string while adding data in request body

Open
#1,973 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

I am adding one parameter in request body if POST request (Content-Type= "multipart-form/data") but after adding when i set edited body in kong request, file format changed from csv to string. And i am getting 400 Bad Request because MultiPartFile parameter not found in Request Body. Pls help

Code:

local body = kong.request.get_body()
body["vendor"]="{ "vendorId" : "vikas", "vendorName" : "vikas" }"
kong.service.request.set_body(body)

Request Body:
Screenshot 2021-11-14 at 4 16 59 PM

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.

Research direction

Reproduce the multipart request using kong.request.get_body() and kong.service.request.set_body() with the shown vendor value, then inspect the request-body handling entry points for how multipart file fields are represented. Done means the edited request preserves the multipart file parameter and no longer produces the reported 400 Bad Request.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.