在 Coldfusion 中获取 POST 数据,而不是在 Form 中

Gla*_*ost 1 coldfusion post curl

我需要将 POST 中的数据发送到 Coldfusion 并检索它们。电话将是:

curl -X POST http://apitest.localhost/test.cfm -H 'Content-Type: application/json' -d '{"test": 1}'
Run Code Online (Sandbox Code Playgroud)

但是在test.cfm里面我无法得到-d发送的数据。只有当它们在表单中发送时,我才能获取 POST 数据,例如

 -F 'form={"test":"1"}'
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我可以在表单对象中访问我的 json 数据。

这不是我想要的!!!常规的body post数据在哪里?

Gla*_*ost 5

哦我发现

getHttpRequestData().content
Run Code Online (Sandbox Code Playgroud)

它似乎工作