You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Postman中同时携带请求参数与请求体发送POST请求

How to Send Both @RequestParam and @RequestBody in Postman

Got it, let's break down why you're hitting those errors first, then fix it step by step:

  • When you use form-data, Postman sends data as multipart/form-data. But your backend expects a separate request body (via @RequestBody)—form-data doesn't populate that dedicated body field, hence the "missing request body" error.
  • When you switch to raw (Text), you're sending a request body, but you aren't including the to and subject parameters that your @RequestParam annotations are looking for, so you get the "missing parameters" error.

Here's exactly how to set it up correctly:

  1. Add your @RequestParam values in the Params tab

    • Go to the Params tab (right next to the URL bar in Postman).
    • Add two key-value pairs:
      • Key: to, Value: [your intended recipient, e.g., user@example.com]
      • Key: subject, Value: [your subject line, e.g., Test Request]
        Postman will automatically append these as query parameters to your request URL, which is exactly what @RequestParam expects.
  2. Set up your @RequestBody in the Body tab

    • Switch to the Body tab.
    • Select the raw option, then use the dropdown menu to pick the right format (since your @RequestBody is a String, Text works perfectly—if you were sending JSON, choose JSON instead).
    • In the text box below, paste or type your content string (e.g., This is the body content I want to send to the user).
  3. Double-check the Content-Type header

    • Postman usually sets this automatically when you select a raw format, but it's good to confirm:
      • For Text format, the Content-Type should be text/plain.
      • For JSON format, it should be application/json.
        You can verify or adjust this in the Headers tab if needed.

Hit send, and your backend should now receive both the to/subject parameters and the content body correctly.

内容的提问来源于stack exchange,提问作者Bartek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:06:27