WINDOWS 命令行执行post请求报错,如下所示
PS C:\Users\lenovo\go\demo> curl -X POST http://127.0.0.1:8199/api/post
Invoke-WebRequest : 找不到与参数名称“X”匹配的参数。
所在位置 行:1 字符: 6
+ curl -X POST http://127.0.0.1:8199/api/post
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest],ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
执行这样请求就成功了
PS C:\Users\lenovo\go\demo> curl -Uri http://127.0.0.1:8199/api/post -Method 'POST'
post
Forms : {}
Headers : {[Trace-Id, b878156af2d24f17f0e85d68ae9c82e6], [Content-Length, 4], [Content-Type, text/plain; charset=utf-8], [Date, Sun, 26 Mar 2
023 01:12:04 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 4