javascript - 如何将 WebKitFormBoundary 解析为 netlify 函数?
问题描述
我的问题是我将 FormData 类型的记录发送到我的 netlify 函数。
表格代码:
const onSubmitWithReCAPTCHA = async (e) =>{
e.preventDefault()
const action = e.target.action
const data = new FormData(e.target)
const token = await
recaptchaRef.current.executeAsync()
data.set("g-recaptcha-response", token)
fetch(action, {
method: "post",
body: data,
}).then((_response) => {
return navigate("/")
})
}
那是我的 WebKitFormBoundary 到达 netlify 函数:
------WebKitFormBoundaryi7nDDId3RXxrRRso
Content-Disposition: form-data; name="bot-field"
------WebKitFormBoundaryi7nDDId3RXxrRRso
Content-Disposition: form-data; name="form-name"
newsletter
------WebKitFormBoundaryi7nDDId3RXxrRRso
Content-Disposition: form-data; name="email"
test@gmail.com
------WebKitFormBoundaryi7nDDId3RXxrRRso
Content-Disposition: form-data; name="g-recaptcha-response"
------WebKitFormBoundaryi7nDDId3RXxrRRso--
如何在 netlify 函数中解析此 WebKitFormBoundary 以将电子邮件提取为字符串?不幸的是,我在互联网上没有找到一个例子……</p>
解决方案
推荐阅读
- python - Python 从 32 位获取有符号整数
- gradle - 如何将 Ivy 作为模块依赖添加到 IntelliJ
- r - R 使用 stringr::str_extract g
- html - CSS 属性值何时/为什么需要指定“px”?
- csv - 如何在 Golang 中过滤 [][] 字符串切片的元素?
- visual-studio-code - 如何恢复已删除的 VSCode 设置?
- c# - 为什么 Unity Canvas Image 总是在我的游戏对象上渲染,即使它肯定在它们后面?
- apache-superset - 在 docker 模式下运行时如何应用超集迁移?
- duplicates - 当端点位于负载均衡器之后时避免重复数据删除
- java - 如何将多个片段数据获取到单个活动中