aws / aws/aws-lambda-runtime-interface-emulator

Support http-request with multipart/form-data.

未關閉
#61 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Go
星號
1.1k
分支
118
平均合併
42 分鐘
30 天內合併 PR
2

描述

When sending http-request using curl or postman with content-type as ‘application/json’, it is working well.
`curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{[body with json]}'`
But with content-type as ‘multipart/form-data’, it is not working with error about “unmarshal input : ‘utf-8’”
`curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" --form '[some message or file]'`

Error log
`START RequestId: 869477bd-4c63-4d81-802c-416e9634067b Version: $LATEST
Traceback (most recent call last):able to unmarshal input: 'utf-8' codec can't decode byte 0xb9 in position 451: invalid start byte
END RequestId: 869477bd-4c63-4d81-802c-416e9634067b
REPORT RequestId: 869477bd-4c63-4d81-802c-416e9634067b Duration: 20.28 ms Billed Duration: 100 ms Memory Size: 3008 MB Max Memory Used: 3008 MB`

It need to support content-type as ‘multipart/form-data’. I wonder it is possible or only support ‘application/json’.

貢獻指南

開啟貢獻指南

研究方向

首先,使用 issue 中的 curl --form 範例重現對 /2015-03-31/functions/function/invocations 的請求,並與正常運作的 JSON 請求進行比較。從該 endpoint 開始追蹤 emulator 的請求處理流程;當包含 messages 或 files 的 multipart/form-data 請求能夠被接受,且不再出現 UTF-8 unmarshal 錯誤時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
go
領域
api, backend
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。