简体   繁体   English

是否可以在 POST 请求正文中发送 Json 数据和图像作为表单数据

[英]Is it possible to send Json Data in the POST request body and an image as form-data

I have a POST request that has an image attached as form-data.我有一个 POST 请求,其中附有图像作为表单数据。 I would like to send additional data as json in the request body.我想在请求正文中以 json 的形式发送附加数据。 Is this possible?这可能吗?

Thanks!谢谢!

Within a single Request call is not possible.在单个请求调用中是不可能的。 as you can only define one type of body.因为您只能定义一种类型的主体。

One way you can do it is to stringify your json object and sent it as a string params in your form-data一种方法是对 json object 进行字符串化,并将其作为字符串参数发送到表单数据中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用主体表单数据的nativescript发布请求 - nativescript post request using body form-data 使用 axios 在 POST 多部分/表单数据请求中发送文件和 json - sending file and json in POST multipart/form-data request with axios 将json post请求更改为multipart / form-data - Change a json post request to multipart/form-data 如何使用带有表单数据主体而不是json主体的http'POST'? (Angular2 /打字稿) - How to use http 'POST' with form-data body instead of json body? (Angular2/Typescript) 改造表单数据POST不返回JSON - Retrofit form-data POST not return JSON 如何使用 OpenAPI 3 在 multipart/form-data 请求的请求正文中格式化 JSON 数组? - How to format a JSON array in the request body of a multipart/form-data request with OpenAPI 3? 如何通过HttpClient在POST请求中将JSON数据作为正文发送 - How to send JSON data as body in POST request through HttpClient 邮递员:通过表单数据的嵌套 JSON 的 POST 请求不起作用(而通过原始数据可以) - Postman: POST request of nested JSON via form-data not working (while via raw-data ok) Http POST如何使用multipart / form-data在文件内部发送JSON - Http POST how to send JSON with file inside using multipart/form-data 通过HTTPS POST将JSON,多部分/表单数据发送到url(C#) - Send JSON, multipart/form-data via HTTPS POST to url (C#)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM