【问题标题】:Postman can't send post request to server and server detecting it as get request instead of post邮递员无法将发布请求发送到服务器并且服务器将其检测为获取请求而不是发布
【发布时间】:2019-02-16 14:58:07
【问题描述】:

邮递员出现问题,无法向服务器发送邮递请求。 所以我有

@GetMapping("/{id}")
public blablabla (@PathVariable long id )

@PostMapping("/scan")
public blablablabla(){}

当我通过邮递员发送/scan的帖子请求时,它会返回

Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; 
nested exception is java.lang.NumberFormatException: For input string: \"scan\

但它在我的 android 应用程序中运行良好。 这是邮递员的问题吗?

谢谢

【问题讨论】:

  • 您必须在发送任何请求之前在邮递员工具中定义内容类型。参考以下链接medium.com/aubergine-solutions/…
  • 我遇到了问题。我已经定义了内容类型。但我向我的 https 服务器发送 http 请求。那就是问题所在。感谢您的支持@Suresh

标签: android spring spring-boot postman


【解决方案1】:

我已经得到了答案.. 在邮递员中,我将 http 请求发送到我的 https 服务器。 所以它重定向它使它成为一个 GET 请求而不是我的 POST 请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-17
    • 1970-01-01
    • 1970-01-01
    • 2016-02-27
    • 2021-07-11
    • 1970-01-01
    相关资源
    最近更新 更多