go TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
文章目录
前言问题分析解决方法
前言
使用swagger测试一个Get路由时,想要传入form-data数据时报错TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
问题分析
GET把参数包含在URL中 POST把通过request body 传递参数。 所以Get路由不能获取body中的form-data数据。
解决方法
换成POST或者把参数放到URL中。
go TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.最先出现在Python成神之路。
共有 0 条评论