Curl 通过API网关接收的二进制数据被篡改 怎么搞的?

Curl 通过API网关接收的二进制数据被篡改 怎么搞的?,curl,aws-lambda,aws-api-gateway,multipartform-data,binary-data,Curl,Aws Lambda,Aws Api Gateway,Multipartform Data,Binary Data,当使用API网关将二进制数据传递给Lambda时,它会变得混乱。 HTTP请求头的ContentType设置为multipart/formdata 下面显示了部分乱码二进制数据 # Collect ┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐ │00000000│ 89 50 4e 47 0d 0a 1a 0a ┊ 00 00 00 0d 49 48 44 52 │×PNG__•_

当使用API网关将二进制数据传递给Lambda时,它会变得混乱。
HTTP请求头的ContentType设置为multipart/formdata

下面显示了部分乱码二进制数据

# Collect
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 89 50 4e 47 0d 0a 1a 0a ┊ 00 00 00 0d 49 48 44 52 │×PNG__•_┊000_IHDR│
│00000010│ 00 00 02 00 00 00 02 00 ┊ 08 06 00 00 00 f4 78 d4 │00•000•0┊••000×x×│
│00000020│ fa 00 00 00 01 73 52 47 ┊ 42 00 ae ce 1c e9 00 00 │×000•sRG┊B0×ו×00│
│00000030│ 00 ea 65 58 49 66 4d 4d ┊ 00 2a 00 00 00 08 00 06 │0×eXIfMM┊0*000•0•│
│00000040│ 01 12 00 03 00 00 00 01 ┊ 00 01 00 00 01 1a 00 05 │••0•000•┊0•00••0•│
│00000050│ 00 00 00 01 00 00 00 56 ┊ 01 1b 00 05 00 00 00 01 │000•000V┊••0•000•│
│00000060│ 00 00 00 5e 01 31 00 02 ┊ 00 00 00 26 00 00 00 66 │000^•10•┊000&000f│
│00000070│ 01 32 00 02 00 00 00 14 ┊ 00 00 00 8c 87 69 00 04 │•20•000•┊000××i0•│
│00000080│ 00 00 00 01 00 00 00 a0 ┊ 00 00 00 00 00 00 00 48 │000•000×┊0000000H│


# Garbled
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ ef bf bd 50 4e 47 0d 0a ┊ 1a 0a 00 00 00 0d 49 48 │×××PNG__┊•_000_IH│
│00000010│ 44 52 00 00 02 00 00 00 ┊ 02 00 08 06 00 00 00 ef │DR00•000┊•0••000×│
│00000020│ bf bd 78 ef bf bd ef bf ┊ bd 00 00 00 01 73 52 47 │××x×××××┊×000•sRG│
│00000030│ 42 00 ef bf bd ef bf bd ┊ 1c ef bf bd 00 00 00 ef │B0××××××┊•×××000×│
│00000040│ bf bd 65 58 49 66 4d 4d ┊ 00 2a 00 00 00 08 00 06 │××eXIfMM┊0*000•0•│
│00000050│ 01 12 00 03 00 00 00 01 ┊ 00 01 00 00 01 1a 00 05 │••0•000•┊0•00••0•│
│00000060│ 00 00 00 01 00 00 00 56 ┊ 01 1b 00 05 00 00 00 01 │000•000V┊••0•000•│
│00000070│ 00 00 00 5e 01 31 00 02 ┊ 00 00 00 26 00 00 00 66 │000^•10•┊000&000f│
│00000080│ 01 32 00 02 00 00 00 14 ┊ 00 00 00 ef bf bd ef bf │•20•000•┊000×××××│
我该怎么做才能修好它

环境 curl向端点发送HTTP请求。
使用以下命令。
curl-H“内容类型:多部分/表单数据”-F file=“@my_file.png”-X POST

HTTP请求正文从API网关传递给Lambda。
API网关上的二进制媒体类型设置了
multipart/form data
image/png

Lambda函数有一个用Base64编码的主体,因此它在Node.js上对其进行解码