使用tsung POST请求发送json

Ale*_*lex 5 xml erlang json erl tsung

我正在尝试用Tsung创建一个POST请求

<request> 
  <http url="api.whatever.com" method="POST" version="1.1" contents=""></http>
</request>
Run Code Online (Sandbox Code Playgroud)

如何在contents属性中发送JSON文档?

contents='{"name": "alex"}' 
Run Code Online (Sandbox Code Playgroud)

当然是无效的......

有没有办法用我的POST请求发送JSON?

Ale*_*lex 7

我能够通过替换" &quot;和添加内容类型头应用程序/ json 来做到这一点

所以我的例子将成为:

content_type='application/json' contents='{&quot;name&quot;: &quot;alex&quot;}
Run Code Online (Sandbox Code Playgroud)